Async cache interop contracts
npm install @soluble/cache-interopPackage holding cache-interop contracts.
You may want to look for official adapter implementations instead.
``bash`
$ yarn add @soluble/cache-interop
`typescript
import {
CacheInterface,
ConnectedCacheInterface,
} from "@soluble/cache-interop";
class MyCache implements CacheInterface, ConnectedCacheInterface {
//...
}
`
> Typescript typeguards
`typescript
import { Guards } from "@soluble/cache-interop";
if (Guards.isConnectedCache(cache)) {
await cache.getConnection().quit();
}
Guards.isValidCacheKey(key);
Guards.isCacheValueProviderFn(async () => {});
Guards.isNonEmptyString("Hi!");
`
> Typescript assertions
`typescript
import { Asserts } from "@soluble/cache-interop";
Asserts.assertValidCacheKey(key);
``
If you are enjoying some of my OSS guides or libs for your company, I'd really appreciate a sponsorship, a coffee or a dropped star. That gives me a tasty morning boost and help me to make some of my ideas come true 🙏
![]() | |
JetBrains | Embie.be |