Struct writium_cache::Cache [] [src]

pub struct Cache<Src: 'static + CacheSource> { /* fields omitted */ }

Cache for each Writium Api. Any Writium Api can be composited with this struct for cache.

Methods

impl<Src: 'static + CacheSource> Cache<Src>
[src]

[src]

[src]

Get the object identified by given ID. If the object is not cached, try generating its cache with provided generation function. If there is no space for another object, the last recently accessed cache will be disposed.

[src]

Set the object identified by given ID with provided new one. If the object is not cached, try generating its cache with provided generation function. If there is no space for another object, the last recently accessed cache will be disposed and returned.

[src]

Remove the object identified by given ID. If the object is not cached, try generating its cache with provided generation function and then remove it. In case cache generation is needed. If there is no space for another object, the last recently accessed cache will be disposed. The value removed as cache is returned.

[src]

The maximum number of items can be cached at a same time.

[src]

Get the number of items cached.