asyncfunctionmain(cacheFactory: ICacheFactory): Promise<void> { // Will add key using the default driver awaitcacheFactory .use() .add("a", 1); // Will add key using the redis addapter awaitcacheFactory .use("redis") .add("a", 1); }
asyncfunctionmain(cacheFactory: ICacheFactory): Promise<void> { awaitcacheFactory .withTypes<string>() .use() // You will se an typescript error .add("a", 1) }
The ICacheFactory contract makes it easy to configure and switch between different IGroupableCache dynamically.