Drop all elements from cache.
Get element from cache.
Number of elements in cache.
Put element to cache.
Remove element from cache.
Set total cache size. 'In' and 'Out' gets 1/6 of total size, Main gets 2/3 of size.
Set In queue size
Set Main queue size
Set Out queue size
Set default ttl (seconds)
// create cache with total size 1024 auto allocator = Mallocator.instance; auto cache = () @trusted { return allocator.make!(Cache2Q!(int, string))(1024); }(); () @safe @nogc nothrow { cache.sizeIn = 10; // if you need, later you can set any size for In queue cache.sizeOut = 55; // and for out quque cache.sizeMain = 600; // and for main cache cache.put(1, "one"); assert(cache.get(1) == "one"); // key 1 is in cache assert(cache.get(2).isNull); // key 2 not in cache assert(cache.length == 1); // # of elements in cache cache.clear; // clear cache }(); dispose(allocator, cache);