Beispiel #1
0
        public void Set(string key, object value, CacheItemCallback callback)
        {
            SetInternal(key, value);

            if (callback != null)
            {
                callback(key, value);
            }
        }
Beispiel #2
0
        public void Set(string key, object value, TimeSpan expires, CacheItemCallback callback)
        {
            CacheItem item = SetInternal(key, value);

            AppHost.AddTimeout(expires, RepeatBehavior.Single, item, HandleExpires);

            if (callback != null)
            {
                callback(key, value);
            }
        }
Beispiel #3
0
        public void Remove(string key, CacheItemCallback callback)
        {
            CacheItem item;
            object value = null;

            if (items.TryGetValue (key, out item)) {
                item.IsRemoved = true;
                items.Remove (key);
                value = item.Item;
            }

            if (callback != null)
                callback (key, value);
        }
Beispiel #4
0
        public void Get(string key, CacheItemCallback callback)
        {
            CacheItem item;
            object res = null;

            if (key == null)
                throw new ArgumentNullException ("key");
            if (callback == null)
                throw new ArgumentNullException ("callback");

            if (items.TryGetValue (key, out item))
                res = item.Item;

            callback (key, res);
        }
Beispiel #5
0
        public void Remove(string key, CacheItemCallback callback)
        {
            CacheItem item;
            object    value = null;

            if (items.TryGetValue(key, out item))
            {
                item.IsRemoved = true;
                items.Remove(key);
                value = item.Item;
            }

            if (callback != null)
            {
                callback(key, value);
            }
        }
Beispiel #6
0
        public void Get(string key, CacheItemCallback callback)
        {
            CacheItem item;
            object    res = null;

            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            if (items.TryGetValue(key, out item))
            {
                res = item.Item;
            }

            callback(key, res);
        }
Beispiel #7
0
        public void Set(string key, object value, TimeSpan expires, CacheItemCallback callback)
        {
            CacheItem item = SetInternal (key, value);

            AppHost.AddTimeout (expires, RepeatBehavior.Single, item, HandleExpires);

            if (callback != null)
                callback (key, value);
        }
Beispiel #8
0
        public void Set(string key, object value, CacheItemCallback callback)
        {
            SetInternal (key, value);

            if (callback != null)
                callback (key, value);
        }