KissCaches.jl

Simple stupid call site caching
Author jw3126
Popularity
2 Stars
Updated Last
3 Years Ago
Started In
September 2020

KissCaches

Stable Dev Build Status Coverage

Usage

julia> using KissCaches

julia> f(x) = (println("hi"); return x)
f (generic function with 1 method)

julia> @cached f(1)
hi
1

julia> @cached f(1)
1

julia> cache = Dict() # customize cache
Dict{Any,Any}()

julia> @cached cache f(1)
hi
1

julia> @cached cache f(1)
1

julia> empty!(cache)
Dict{Any,Any}()

julia> @cached cache f(1)
hi
1

Alternatives

There are multiple excellent alternatives for caching function calls. Most are more sophisticted and work by altering the function definition. KissCaches on the other hand is really simple and alters the function call. See also: