Comments (4)
There are two problems here.
The first problem is that get_many
returns something wrong when we use Memory backend (but Redis backend works fine):
If this is not a bug, but a feature, then please explain me.
import asyncio
from cashews import cache
async def func():
cache.setup('mem://', prefix='foobar')
print(await cache.set('foobar:123', 'value_1', expire=10_000))
print(await cache.set('spameggs:123', 'value_2', expire=10_000))
print(await cache.get_many('foobar:123', 'spameggs:123', 'foobar:123')) # ('value_1', None, 'value_1')
print(await cache.get_many('spameggs:123', 'foobar:123', 'spameggs:123')) # ('value_2', None, 'value_2')
asyncio.run(func())
Another problem is that using prefix like "mem"
for Redis backend gives a side effect that I can not explain now
import asyncio
from cashews import cache
async def func():
cache.setup('redis://0.0.0.0', prefix='mem')
print(await cache.set('mem:123', 'value_1', expire=1_000))
print(await cache.set('mem:456', 'value_2', expire=1_000))
print(await cache.get_many('mem:123', 'mem:456', 'mem:123')) # (None, None, None)
print(await cache.get_many('mem:456', 'mem:123', 'mem:456')) # (None, None, None)
asyncio.run(func())
Using any other prefix
makes get_many
to be working.
Let's wait for Krukov's help here. I never reviewed/investigated "cashews/wrapper.py" code.
from cashews.
Hello,
yes first issue that @easysugar mentioned is a bug and it is a part of wrapper. I think I can fix it a little bit latter.
The second one is not depends on prefix and the bug is much more serious. That is bug because of _
in value (value_1
)
I added more details in separate issue
from cashews.
So the second bug fixed #74
from cashews.
Fixed with 4.5.0
from cashews.
Related Issues (20)
- Update README with migration notes: simple decorator usage is broken after `NotConfiguredError` introducing HOT 4
- How to cache StreamingResponse/Generator? HOT 26
- Alias/tags for cache keys for invalidation
- Transaction for cache changes
- auto strategy to cache HOT 1
- Disabling cache doesnโt work reliably in tests HOT 3
- Cache `bytes` more efficient HOT 1
- lock performance HOT 4
- Invalid register tag with optional arguments HOT 2
- Not support redis unix socket HOT 2
- Error when delete tags the cache before caching itself HOT 2
- TTL type annotation
- Key template doesnt work correctly with class methods HOT 2
- Get keys number
- Allow cache exceptions aka. "white exceptions" HOT 6
- Current implementation of `thunder_protection` may cause "Future exception was never retrieved" warning HOT 1
- Add More contrib modules
- Pass cache result into ttl function HOT 5
- Timeout and Cancelled errors HOT 6
- Improve basic api with external exceptions in case of any Backend errors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cashews.