Files
gitbook/src/lib/cache/backends.ts
T
Samy Pessé 55d1e538d9 More resilient caching and use of KV (#222)
* Add unit tests for "race"

* Reduce to 80s

* Implement a Cloudflare KV cache

* Format

* Lint

* Fix tagging of entries in KV

* No longer use HTTP cache tags

* Simplify tags to only keep 2

* Implement a blockFallback logic

* Improve the block fallback logic

* More tests

* Start introducing a always optional signal on all cache ops

* Correctly pass signal end to end

* Fix one more case and add tests

* Fix it

* Add test for error

* Fix error handling

* Simplify even more

* Improve logs

* Improve logs / measurements

* Fix timing

* Fix read cache duration and add minor tests

* Log redis time

* Change replication logic

* Fix redis errors

* Log more

* More logs and test memory first

* Improve tracing for cache backends

* Ignore all dependencies

* Log the key in the cache low level traces
2024-03-08 09:43:30 +01:00

19 lines
625 B
TypeScript

import { cloudflareCache } from './cloudflare-cache';
import { cloudflareKVCache } from './cloudflare-kv';
import { memoryCache } from './memory';
import { redisCache } from './redis';
export const cacheBackends = [
// Cache local to the process
// (can't be globally purged or shared between processes)
memoryCache,
// Global cache shared between all processes
// with proper replication and invalidation
redisCache,
// Cache local to the datacenter
// It can't be purged globally but it's faster
cloudflareCache,
// Cache global, but with slow replication
cloudflareKVCache,
];