core.cache

Create function backed cache

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None

Description

A cache implementation that is backed by a function that performs some action on a cache miss could serve as a front for any of the existing cache impls.

Activity

Hide
Rich Hickey added a comment -

It doesn't perform an action per se, it gets a passed key and returns a value, which the cache then caches (associates with the key) and returns. The tricky bit is when the function can't get a value. There needs to be some protocol for communicating that (could be like 3 arg get), and, should the cache be asked again later for the same key, calling the fn again.

Show
Rich Hickey added a comment - It doesn't perform an action per se, it gets a passed key and returns a value, which the cache then caches (associates with the key) and returns. The tricky bit is when the function can't get a value. There needs to be some protocol for communicating that (could be like 3 arg get), and, should the cache be asked again later for the same key, calling the fn again.
Hide
Fogus added a comment -

Thanks for the feedback Rich. I believe I understand the subtleties now.

Show
Fogus added a comment - Thanks for the feedback Rich. I believe I understand the subtleties now.
Hide
Sean Corfield added a comment -

@fogus is this the basis for FnCache which doesn't seem to have a factory or be documented/tested? Is that just "dead" code now?

Also, it seems that through fills some of this gap since it provides for functions to run on a cache miss (although it still doesn't address when the function can't get a value, right?).

Show
Sean Corfield added a comment - @fogus is this the basis for FnCache which doesn't seem to have a factory or be documented/tested? Is that just "dead" code now? Also, it seems that through fills some of this gap since it provides for functions to run on a cache miss (although it still doesn't address when the function can't get a value, right?).

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: