caching - How to Java cache in-Memory by group/tag data? -
caching - How to Java cache in-Memory by group/tag data? -
i read java cache in-memory, , see solutions [ key => value ]. it's not plenty when need manipulate more pieces data. example:
{ key: "book1", //1 book id value: { id: 1, name: "book's name", author: "book's author", } }, { key: "book2", value: { id: 2, name: "book's name", author: "book's author", } }, { key: "book3", value: { id: 3, name: "book's name", author: "book's author", } }
how of theme without know id build key : "book"+id. there way tag item, , can tag name.
{ key: "book3", tag: "recentbook" value: { id: 3, name: "book's name", author: "book's author", } }
i expect offer solutions organization construction cache info or library back upwards work tag/group data. thanks!
for indexed access , storage of info need database, not cache. cache, concept, speed things , info in cache of temporary nature. means, design contract, cache may hold info "book3" or evict @ time if there resource shortage , caching of other books yields improve overall performance.
cache solutions may offer persistence option. usage have larger capacity , preserve cache content across restarts. persistence functionality has not same quality databases, e.g. there no info migration of on disk info structures when cache solution upgraded. same holds robustness against info loss, e.g. on powerfulness outage.
so first check if improve in scenario utilize database. there "tiny" databases java e.g. leveldb oder mapdb.
you can "misuse" cache primary storage, e.g. if set capacity limits high enough. in case have sec cache maps tag book ids. can either update cache, whenever book updated. other approach create cache content iterating on books.
java caching data-structures ehcache
Comments
Post a Comment