AccelerationNet/function-cache

API option for clear-cache?

xach opened this issue · 3 comments

xach commented

If I have a cache for a function f, I'd like to be able to clear that cache by doing (clear-cache 'f), rather than remembering the syntax for naming the cache's special variable. Is that possible with the code right now? I couldn't tell from the documentation and a quick look through the source.

If it's not available, I was thinking of adding it via a method for symbols in clear-cache. I'm not sure exactly how I'd do it -- one option would be to stash the name of the special on the symbol-plist of f and then fetching the cache with symbol-value.

Would a patch like that be accepted, or is it philosophically or otherwise incompatible with the goals of function-cache?

Clear cache should already accept the cache function symbol name. I will try to expand the docs to make this clearer.

Cheers

find-function-cache-for-name will use the symbol to find the cache object for you if you do have to make that translation elsewhere.

xach commented

Thanks!