Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi Layer Cache #496

Open
rspadim opened this issue Jun 13, 2020 · 1 comment
Open

Multi Layer Cache #496

rspadim opened this issue Jun 13, 2020 · 1 comment
Labels

Comments

@rspadim
Copy link

rspadim commented Jun 13, 2020

Hi folks!

Could be possible implement a multi layer cache? example:

  1. 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

@argaen
Copy link
Member

argaen commented Oct 15, 2020

Hey @rspadim yeah this is a common use case that I see repeated in different places but it is a completely new dimension of implementation and feature. Feel free to add a proposal PR with the feature and we can discuss there! We could name the new type something like "MultiLayerCache" or something like that.

However, to cover the case you mention about having less data in memory cache you would need something that helps limit that #498

@argaen argaen added the feature label Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants