Skip to content

Commit

Permalink
Add simple case example
Browse files Browse the repository at this point in the history
  • Loading branch information
kubo39 committed May 19, 2024
1 parent 9c8e609 commit b1b181d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/simple/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
simple
2 changes: 2 additions & 0 deletions examples/simple/dub.sdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name "simple"
dependency "sievecache" path="../../"
17 changes: 17 additions & 0 deletions examples/simple/source/app.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sievecache;

import std.stdio;

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

cache.insert("foo", "foocontent");
cache.insert("bar", "barcontent");
cache.remove("bar");

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

0 comments on commit b1b181d

Please sign in to comment.