KeySet & ehcache
KeySet is a view of keys contained in the Map.
In ehcache, I store <id, Map>.
Map oldAuthApInfos = cache.get(id);
SetoldBssids = oldAuthApInfos.keySet();
...
oldBssids.removeAll(newBssids);
This would result in map entries getting removed from cache. By default, ehcache uses memoryStore and basically is a map. The operation on the returned map have direct effect on cache value itself. I used to think the returned map of cache.get() is a serialized copy of the cache value.
2 comments:
You can get the serialized behavior you were expecting by using copyOnRead/copyOnWrite in the config
http://ehcache.org/documentation/configuration.html
Thank you. It's good to know.
Post a Comment