1 #include "wvmrucache.h"
2 #include "wvgdbmhash.h"
6 typedef WvMRUCache
<WvString
, datum
, DatumCacheHelper
> MyCache
;
10 dummy
.dptr
= (char *)10;
14 WvString
silly("silly");
16 cache
.add(silly
, dummy
);
20 cache
.add(silly
, dummy
);
25 cache
.add(silly
, dummy
);
30 cache
.add(silly
, dummy
);
35 cache
.add(silly
, dummy
);
39 WvString
silly("silly2");
41 cache
.add(silly
, dummy
);
45 cache
.add(silly
, dummy
);
50 cache
.add(silly
, dummy
);
55 cache
.add(silly
, dummy
);
60 cache
.add(silly
, dummy
);
63 assert(cache
.maybe_get("zig2").dptr
);
64 assert(cache
.maybe_get("baz2").dptr
);
65 assert(cache
.maybe_get("bar2").dptr
);
66 assert(cache
.maybe_get("foo2").dptr
);
67 assert(cache
.maybe_get("silly2").dptr
);
69 assert(!cache
.maybe_get("foo").dptr
);
70 assert(!cache
.maybe_get("woo").dptr
);
72 fprintf(stderr
, "success\n");