java - Guava Caches / configurable eviction / buffer replacement strategies -
are other replacement strategies planned regarding maximum size eviction? need mru algorithm, such system benefits cache. system stores records in blocks on disk or in cached pages in-memory, whereas pages/records not clustered (that not stored in preorder after updates). records in case nodes in tree-structure.
the system assigns record-ids in ascending order (that @ first in preorder) , stores records in pages incremented id (0, 1, 2...). after updates however, if records/nodes instance need traversed in preorder might page read records 1, 2, 3, 4, 5, 6, 7, 8, 9, 10... nodes have been inserted between node 6 , 7 (for instance node 11 large subtree). in case cache useful if preserves first page (which stores records 1,2...,10 if cache size 1 , subtree rooted @ node 11 belongs page. first page must fetched twice. it's case other tree-traversal methods, mru more useful lru, maybe other clever algorithms exist might better suited. aspect of self-tuning.
sorry long description of use case (a versioned data storage system), hope it's valid use case. nice if size-based eviction configurable in cases lru makes sense (however not tree-traversals).
edit: don't need concurrency support long i'm allowing 1 write-transaction @ time (because guava splits entries different segments, such it's not using global lru algorithm).
the design philosophy not make guarantee on algorithm behavior of element size based eviction policy decides evict. provides flexibility evolve more advanced eviction policy, such lirs, , improve cache's design, e.g. not segmented. contract cache try intelligently choose victim satisfies majority of use-cases.
the current implementation overly complex, imho, , not in favor of providing numerous toggles tune algorithm. make api confusing small subset of users, restrict ability make design improvements, , increase complexity beyond tolerable level. preferable roll own solution best matches problem when guava's generalist approaches not correct fit.
the right answer depends on use-case. if don't need high concurrency there many obvious answers. if do, though, forking concurrentlinkedhashmap use mru policy may least painful. middle ground of custom implementation, e.g. perhaps using simplified version of buffering strategy, may easiest encapsulate in large code base.
Comments
Post a Comment