aio-libs / aio-libs/aiocache

Multi Layer Cache

Offen
#496 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
feature
Vorherrschende Sprache
Python
Sterne
1.4k
Forks
181
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi folks!

Could be possible implement a multi layer cache? example:

0) creating the cache:
```
'cache': [
{
'cache': "aiocache.SimpleMemoryCache",
'serializer': {
'class': "aiocache.serializers.StringSerializer"
}
},
{
'cache': "aiocache.RedisCache",
'endpoint': "127.0.0.1",
'port': 6379,
'timeout': 1,
'serializer': {
'class': "aiocache.serializers.PickleSerializer"
}
}
]
```

1) cache.set("key", "value") / cache.delete("key")
1.1) cache will execute function to all layers

2) cache.get("key")
2.1) a `for i in layers:` will check what's the first cache that have this data
2.2) if it's not the first layer and data was found, update from current layer to first layer

why? the idea is have a memory cache with less cached items than the redis cache, and when it's not found on local memory check redis value

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.