(store: Store, ttl: number | undefined, namespaceSuffix?: string)
| 196 | } |
| 197 | |
| 198 | function getKeyvInstance(store: Store, ttl: number | undefined, namespaceSuffix?: string): Keyv { |
| 199 | switch (store) { |
| 200 | case 'redis': |
| 201 | return new Keyv(getConfig('redis', ttl, namespaceSuffix)); |
| 202 | case 'memory': |
| 203 | default: |
| 204 | return new Keyv(getConfig('memory', ttl, namespaceSuffix)); |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | function getConfig(store: Store = 'memory', ttl: number | undefined, namespaceSuffix = ''): KeyvOptions { |
| 209 | const config: KeyvOptions = { |