예제 #1
0
 public SparkViewBase.CacheScopeImpl End(ICacheSignal signal)
 {
     if (this._recording)
     {
         CacheMemento item = this._originator.EndMemento();
         this._cacheService.Store(this._identifier, this._expires, signal, item);
     }
     return(this._previousCacheScope);
 }
예제 #2
0
        private static void AddToCache(this Dictionary <string, CacheMemento> cache, INakedObjectsFramework framework, INakedObject nakedObject, string url, ObjectFlag flag)
        {
            string objectId = framework.GetObjectId(nakedObject);

            cache[objectId] = new CacheMemento {
                Added = DateTime.Now, Spec = nakedObject.Spec.FullName, Url = url
            };
            while (cache.Count > CacheSize)
            {
                RemoveOldest(cache, flag);
            }
        }
        private static void AddToCache(this Dictionary <string, CacheMemento> cache, IFrameworkFacade facade, IObjectFacade nakedObject, string url, ObjectFlag flag)
        {
            var loid = facade.OidTranslator.GetOidTranslation(nakedObject);

            string objectId = loid == null ? "" : loid.Encode();

            cache[objectId] = new CacheMemento {
                Added = DateTime.Now, Spec = nakedObject.Specification.FullName, Url = url
            };
            while (cache.Count > CacheSize)
            {
                RemoveOldest(cache, flag);
            }
        }
예제 #4
0
            public bool Begin()
            {
                CacheMemento memento = this._cacheService.Get(this._identifier) as CacheMemento;

                if (memento == null)
                {
                    this._recording = true;
                    this._originator.BeginMemento();
                }
                else
                {
                    this._recording = false;
                    this._originator.DoMemento(memento);
                }
                return(this._recording);
            }
        private static void AddOrUpdateInCache(this Dictionary <string, CacheMemento> cache, IFrameworkFacade facade, IObjectFacade nakedObject, string url, ObjectFlag flag)
        {
            string objectId = facade.OidTranslator.GetOidTranslation(nakedObject).Encode();

            if (cache.ContainsKey(objectId))
            {
                cache[objectId].Spec = nakedObject.Specification.FullName;
                cache[objectId].Url  = url;
            }
            else
            {
                cache[objectId] = new CacheMemento {
                    Added = DateTime.Now, Spec = nakedObject.Specification.FullName, Url = url
                };
                while (cache.Count > CacheSize)
                {
                    RemoveOldest(cache, flag);
                }
            }
        }
예제 #6
0
 private static void AddToCache(this Dictionary<string, CacheMemento> cache, INakedObject nakedObject, string url, ObjectFlag flag) {
     string objectId = FrameworkHelper.GetObjectId(nakedObject);
     cache[objectId] = new CacheMemento {Added = DateTime.Now, Spec = nakedObject.Specification, Url = url};
     while (cache.Count > CacheSize) {
         RemoveOldest(cache, flag);
     }
 }