I have this code
//net.sf.jsr107cache.Cache, CacheException, CacheFactory, CacheManager all imported
private static Cache getCache() {
Cache cache = null;
try {
CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
cache = cacheFactory.createCache(Collections.emptyMap());
} catch (CacheException e) {
Logger.getLogger(MemcacheUtil.class.getName()).log(Level.SEVERE,
"Unable to obtain a cache instance! \n" + e.getMessage());
}
return cache;
}
and use it like this
public static byte[] fetchFromMemcache(String key) {
return (byte[]) getCache().get(key);
}
public static void saveInMemcache(String key, byte[] value) {
getCache().put(key, value);
}
but annoyingly, nothing gets stored in Memcache and no log message gets printed. Before implementing caching with JCache, I used the Low-level API and had the same problem too. I'm really confused. Is there any special setting (in code, on the appengine console, etc) that needs to be done before Memcache works? Does Memcache just hate me naturally? Is there something I'm doing (or failing to do) in code that's causing all these? Please I'll like to know how to go about this. Thanks!