public void StartCacheProcesses()
        {
            factory           = new CacheManagerFactory(Context);
            shortCacheManager = factory.GetCacheManager("ShortInMemoryPersistence");
            smallCacheManager = factory.GetCacheManager("SmallInMemoryPersistence");

            expiredKeys    = "";
            expiredValues  = "";
            removalReasons = "";
        }
示例#2
0
        public override void FixtureSetup()
        {
            base.FixtureSetup();
            CacheManagerFactory factory = new CacheManagerFactory(Context);

            cache = factory.GetCacheManager("InDatabasePersistence");
        }
示例#3
0
        public void GetCacheManagerWithNullEncryption()
        {
            CacheManagerFactory factory = new CacheManagerFactory(Context);
            CacheManager        mgr     = factory.GetCacheManager("InMemoryPersistenceWithNullEncryption");

            CacheManagerTest(mgr);
        }
示例#4
0
        public void CreateCache()
        {
            removedKey    = null;
            expiredValue  = null;
            removalReason = CacheItemRemovedReason.Unknown;

            factory  = new CacheManagerFactory(Context);
            cacheMgr = factory.GetCacheManager("SmallInMemoryPersistence");
        }
示例#5
0
        public void CallingDifferentFactoryTwiceReturnsDifferentInstances()
        {
            CacheManager cacheOne = factory.GetCacheManager("InMemoryPersistence");

            CacheManagerFactory secondFactory = new CacheManagerFactory(Context);
            CacheManager        cacheTwo      = secondFactory.GetCacheManager("InMemoryPersistence");

            Assert.IsFalse(object.ReferenceEquals(cacheOne, cacheTwo), "Different factories should always return different instances for same instance name");
        }
        public void CallingDifferentFactoryTwiceReturnsDifferentInstances()
        {
            CacheManager cacheOne = factory.GetCacheManager("InMemoryPersistence");

            CacheManagerFactory secondFactory = new CacheManagerFactory(Context);
            CacheManager cacheTwo = secondFactory.GetCacheManager("InMemoryPersistence");

            Assert.IsFalse(object.ReferenceEquals(cacheOne, cacheTwo), "Different factories should always return different instances for same instance name");
        }
        public void StartCacheProcesses()
        {
            sharedLock       = new object();
            callbackCount    = 0;
            callbackReason   = CacheItemRemovedReason.Unknown;
            exceptionMessage = "";

            factory      = new MockCacheManagerFactory(Context);
            cacheManager = factory.GetCacheManager("ShortInMemoryPersistence");
        }
示例#8
0
        protected ServiceBase()
        {
            CacheManagerFactory = DependencyManager.Current.Resolver.GetService <ICacheManagerFactory>();

            CacheManager = CacheManagerFactory.GetCacheManager();

            ActionContext = ActionContextFactory.GetActionContext();

            Logger = LoggerFactory.GetLoggerInstance();
        }
        public void CanCreateIsolatedStorageCacheManager()
        {
            cacheManager.Add("bab", "foo");
            Assert.AreEqual(1, cacheManager.Count);

            CacheManagerFactory differentFactory = new CacheManagerFactory(Context);
            CacheManager differentCacheManager = differentFactory.GetCacheManager("InIsoStorePersistence");
            int count = differentCacheManager.Count;
            differentCacheManager.Dispose();

            Assert.AreEqual(1, count, "If we actually persisted added item, different cache manager should see item, too.");
        }
        private void CacheManagerTest(string instanceName)
        {
            CacheManagerFactory factory = new CacheManagerFactory(Context);
            CacheManager mgr = factory.GetCacheManager(instanceName);

            string key = "key1";
            string val = "value123";

            mgr.Add(key, val);

            string result = (string)mgr.GetData(key);
            Assert.AreEqual(val, result, "result");
        }
        public void CanCreateIsolatedStorageCacheManager()
        {
            cacheManager.Add("bab", "foo");
            Assert.AreEqual(1, cacheManager.Count);

            CacheManagerFactory differentFactory      = new CacheManagerFactory(Context);
            CacheManager        differentCacheManager = differentFactory.GetCacheManager("InIsoStorePersistence");
            int count = differentCacheManager.Count;

            differentCacheManager.Dispose();

            Assert.AreEqual(1, count, "If we actually persisted added item, different cache manager should see item, too.");
        }
        private void CacheManagerTest(string instanceName)
        {
            CacheManagerFactory factory = new CacheManagerFactory(Context);
            CacheManager        mgr     = factory.GetCacheManager(instanceName);

            string key = "key1";
            string val = "value123";

            mgr.Add(key, val);

            string result = (string)mgr.GetData(key);

            Assert.AreEqual(val, result, "result");
        }
 public override void FixtureSetup()
 {
     base.FixtureSetup ();
     CacheManagerFactory factory = new CacheManagerFactory(Context);
     cache = factory.GetCacheManager("InDatabasePersistence");
 }
示例#14
0
        public void CreateNamedCacheInstance()
        {
            CacheManager cache = factory.GetCacheManager("InMemoryPersistence");

            Assert.IsNotNull(cache, "Should have created caching instance through factory");
        }
示例#15
0
        public void CreateCache()
        {
            removedKey = null;
            expiredValue = null;
            removalReason = CacheItemRemovedReason.Unknown;

            factory = new CacheManagerFactory(Context);
            cacheMgr = factory.GetCacheManager("SmallInMemoryPersistence");
        }
 public void CreateCacheManager()
 {
     factory = new CacheManagerFactory(Context);
     cacheManager = factory.GetCacheManager("InIsoStorePersistence");
 }
示例#17
0
        public void StartCacheProcesses()
        {
            factory = new CacheManagerFactory(Context);
            shortCacheManager = factory.GetCacheManager("ShortInMemoryPersistence");
            smallCacheManager = factory.GetCacheManager("SmallInMemoryPersistence");

            expiredKeys = "";
            expiredValues = "";
            removalReasons = "";
        }
 public void CreateCacheManager()
 {
     factory      = new CacheManagerFactory(Context);
     cacheManager = factory.GetCacheManager("InIsoStorePersistence");
 }
 public void GetCacheManagerWithNullEncryption()
 {
     CacheManagerFactory factory = new CacheManagerFactory(Context);
     CacheManager mgr = factory.GetCacheManager("InMemoryPersistenceWithNullEncryption");
     CacheManagerTest(mgr);
 }