/sieve-cache-d

A SIEVE cache implementation for D

Primary LanguageDMIT LicenseMIT

SIEVE Cache in D

An implementation of the SIEVE Cache eviction algorithm for D. This implementation is fully inspired by Rust's sieve-cache implementation.

Usage

import sievecache;

import std.stdio;

void main()
{
    auto cache = SieveCache!(string, string)(10_000);

    cache["foo"] = "foocontent";
    cache["bar"] = "barcontent";
    cache.remove("bar");

    writeln(cache["foo"]);           // "foocontent"
    writeln(!cache.contains("bar")); // false
    writeln(cache.length);           // 1
    writeln(cache.capacity);         // 10000
}

Development

Testing

dub test

Lint

dub lint

Serve the docmentation on a local server

dub run -b ddox