Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching utility macros: defcacheable, defevict and defupdatable #39

Closed
cabol opened this issue Jan 10, 2019 · 0 comments
Closed

Caching utility macros: defcacheable, defevict and defupdatable #39

cabol opened this issue Jan 10, 2019 · 0 comments
Labels

Comments

@cabol
Copy link
Owner

cabol commented Jan 10, 2019

Implement utility macos:

defcacheable

Defines a cacheable function with the given name fun and arguments args. The returned value by the code block is cached if it doesn't exist already in cache, otherwise, it is returned directly from cache and the code block is not executed.

defcacheable cacheable_fun(x, y \\ "y"), cache: Cache, key: x do
  # logic ...
end

defevict

Defines a function with cache eviction enabled on function completion (one or all values are removed on function completion).

defevict evict_fun(x), cache: Cache, key: x do
  # logic ...
end

defupdatable

Defines an updatable caching function. The content of the cache is updated without interfering the function execution. That is, the method would always be executed and the result cached.

defupdatable updatable_fun(x), cache: Cache, key: x do
  # logic ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant