aiocache
aiocache copied to clipboard
Merge cache implementation classes for each backend
Background
Each backend cache implementation is currently split into two classes, with the "interface" class derived from the "backend" class.
-
SimpleMemoryCache
subclassesSimpleMemoryBackend
, which subclassesBaseCache[str]
. -
MemcachedCache
subclassesMemcachedBackend
, which subclassesBaseCache[bytes]
. -
RedisCache
subclassesRedisBackend
, which subclassesBaseCache[str]
.
Suggestion
Merge each pair into a single subclass of BaseClass
. In other words, the ...Backend
classes do not appear to provide any benefit or value by being distinct classes.
-
SimpleMemoryCache
is highly bound toSimpleMemoryBackend
, even in its name. It seems unlikely that anyone would useSimpleMemoryBackend
directly, rather than usingSimpleMemoryCache
. - Also
SimpleMemoryBackend
does not appear to provide value as a base class for user customization. If a specialized memory cache is needed, one would probably derive fromSimpleMemoryCache
and override only what is needed, or derive fromBaseCache
if more extensive changes are required.
Question
Are any aiocache
users relying on SimpleMemoryBackend
, MemcachedBackend
, RedisBackend
classes, or could their functionality be merged into the corresponding ...Cache
implementations?