Aardvark.Base.Incremental


Cache<'a, 'b>

Cache represents a cached function which can be invoked and revoked. invoke increments the reference count for a specific argument (possibly causing the function to be executed) whereas revoke decreases the reference count and removes the cache entry whenever the reference count is 0.

Constructors

ConstructorDescription
new(scope, f)
Signature: (scope:Scope * f:('a -> 'b)) -> Cache<'a,'b>
new(f)
Signature: (f:('a -> 'b)) -> Cache<'a,'b>

Instance members

Instance memberDescription
Clear(remove)
Signature: (remove:('b -> unit)) -> unit

Clear removes all entries from the Cache and executes a function for all removed cache entries. this function is helpful if the contained values are (for example) disposable resources.

Invoke(v)
Signature: v:'a -> 'b

invoke returns the function value associated with the given argument (possibly executing the function) and increases the associated reference count.

Revoke(v)
Signature: v:'a -> 'b
RevokeAndGetDeleted(v)
Signature: v:'a -> bool * 'b

revoke returns the function value associated with the given argument and decreases its reference count.

Values
Signature: seq<'b>
Fork me on GitHub