CachedCalls
CachedCalls._deconstruct
CachedCalls._extract_kwargs
CachedCalls.cachedcalls_dir
CachedCalls.cachedcalls_dir
CachedCalls.@cached_call
CachedCalls.@hash_call
CachedCalls._deconstruct
— Method_deconstruct(ex)
Deconstruct expression ex
to a tuple (function name, arguments, kwarg names, kwarg values)
CachedCalls._extract_kwargs
— Method_extract_kwargs(callargs::AbstractArray{Any}; keep_args=false)
Extract a tuple of (:kwarg_name, value) from :call expression args.
CachedCalls.cachedcalls_dir
— Methodcachedcalls_dir(p::Union{String, PosixPath})
Sets the path to where the cached files are stored to p
.
CachedCalls.cachedcalls_dir
— Methodcachedcalls_dir()
Retrieves the path to where the cached files are stored.
CachedCalls.@cached_call
— Macro@cached_call f(args; kwargs)
Caches the result of f(args; kwargs)
to disk and returns the result. The next time f(args; kwargs)
is called with the same values of args
and kwargs
the cached result is returned and f
is not called again. Splatting is not yet supported.
Restrictions on f
apply: it must not mutate its arguments or access/mutate globals. These assumptions will not be checked and if violated could mean that an incorrect result is returned.
Functions are differentiated by name only, meaning that changing the definition and rerunning @cached_call
will return the wrong result.
CachedCalls.@hash_call
— Macro@hash_call f(args; kwargs)
Computes the hash of the function call f(args; kwargs)
by hashing f
, the values of args
, the names of kwargs
, and the values of kwargs
.
Different order of kwargs will hash differently. Setting the default values of kwargs explicitly will hash differently than using the defaults implicitly. Splatting is not yet supported.