core.cache

Implement SoftCache

Details

  • Type: Task Task
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Clache had a buggy implementation of a cache backed by soft references. This capability should be explored further and implemented properly for core.cache.

Activity

Hide
Fogus added a comment -

Actually released in version 0.6.1.

Show
Fogus added a comment - Actually released in version 0.6.1.
Hide
Fogus added a comment -

Planned for v0.7.0

Show
Fogus added a comment - Planned for v0.7.0
Hide
Fogus added a comment -

I have no problem with internal mutability in the cache impls, so that immutable code might not be needed. I've pushed the 0.7.0-SNAPSHOT version with your additions and will run it through the paces post-haste. Thank you for tackling this Paul, it's a huge help.

Show
Fogus added a comment - I have no problem with internal mutability in the cache impls, so that immutable code might not be needed. I've pushed the 0.7.0-SNAPSHOT version with your additions and will run it through the paces post-haste. Thank you for tackling this Paul, it's a huge help.
Hide
Paul Stadig added a comment - - edited

I've implemented a mutable SoftCache. I felt as though the tradeoffs made it worth using a ConcurrentHashMap as the base for SoftCache.

SoftReference objects are mutable (and tied to a specific instance of ReferenceQueue). ReferenceQueue is mutable. Using an immutable map as the base for SoftCache would cost {O(n)} when removing cleared SoftReference objects from the cache.

If immutability is desirable, I also have an implementation of an immutable SoftCache, but it suffers from the above {O(n)} cost.

Show
Paul Stadig added a comment - - edited I've implemented a mutable SoftCache. I felt as though the tradeoffs made it worth using a ConcurrentHashMap as the base for SoftCache. SoftReference objects are mutable (and tied to a specific instance of ReferenceQueue). ReferenceQueue is mutable. Using an immutable map as the base for SoftCache would cost {O(n)} when removing cleared SoftReference objects from the cache. If immutability is desirable, I also have an implementation of an immutable SoftCache, but it suffers from the above {O(n)} cost.
Hide
Paul Stadig added a comment -

I'd be interested in taking a crack at this, but would find it useful to have more infos about what bugs existed in the Clache implementation.

Show
Paul Stadig added a comment - I'd be interested in taking a crack at this, but would find it useful to have more infos about what bugs existed in the Clache implementation.

People

  • Assignee:
    Unassigned
    Reporter:
    Fogus
Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: