예제 #1
0
        public CachedObjectSource(T instance, IObjectCache <T> cache)
        {
            this.weakInstance = new WeakReference <T>(instance);
            this.cache        = cache;

            this.evictAction = new WeakAction <CachedObjectSource <T>, T>(this, (o, d) => o.OnEvicted(d));
            cache.AddOrAccess(instance, this.evictAction);
        }