Files
DefinitelyTyped/types/catbox/catbox-tests.ts
Silas Rech 484883ab60 [catbox] Fix classes (#18072)
* [catbox] Fix classes

* Class extends Class => Class implements Interface

* Add TSLint configuration

* Add initial tests (Basically testing if I understood how the tests here work 😏)

* Fix tests

* Don't set Memory to any
2017-07-20 08:58:40 -07:00

28 lines
580 B
TypeScript

import Catbox = require("catbox");
const Memory: Catbox.EnginePrototypeOrObject = {
start(callback: Catbox.CallBackNoResult) {},
stop() {},
get() {},
set() {},
drop() {},
isReady(): boolean { return true; },
validateSegmentName(segment: string): null { return null; },
};
const client = new Catbox.Client(Memory, { partition: 'cache' });
const cache = new Catbox.Policy({
expiresIn: 5000,
}, client, 'cache');
cache.set('foo', 'bar', 5000, () => {});
cache.get('foo', () => {});
cache.drop('foo', () => {});
cache.isReady();
cache.stats();