mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-20 16:14:57 +08:00
* [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
28 lines
580 B
TypeScript
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();
|