Skip to content

Multi Layer Cache #496

@rspadim

Description

@rspadim

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions