Exhibit 1: Simple cache creation
-------------------------------------------
CacheManager cacheManager1 =
Caching.getCacheManagerFactory().getCacheManager("tsampleCacheManager");
Cache<String, Integer> cache = cacheManager.getCache("sampleCache");
int value1 = 9876;
cache.put(key, value1);
int value = cache.get(key).intValue()
Exhibit 2: Using cache configuration with a custom cache expiry
-----------------------------------------------------------------------------------
CacheManager cacheManager =
Caching.getCacheManagerFactory().getCacheManager("test");
String cacheName = "cacheXXX";
cache = cacheManager.<String, Integer>createCacheBuilder(cacheName).
setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new
CacheConfiguration.Duration(TimeUnit.SECONDS, 10)).
setStoreByValue(false).build();
int value = 9876;
cache.put(key, value);
assertEquals(cache.get(key).intValue(), value);
--
*Afkham Azeez*
Director of Architecture; WSO2, Inc.; http://wso2.com
Member; Apache Software Foundation; http://www.apache.org/
* <http://www.apache.org/>**
email: **[email protected]* <[email protected]>* cell: +94 77 3320919
blog: **http://blog.afkham.org* <http://blog.afkham.org>*
twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture