GithubHelp home page GithubHelp logo

Comments (4)

AIGeneratedUsername avatar AIGeneratedUsername commented on May 27, 2024 1

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.

Krukov avatar Krukov commented on May 27, 2024

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.

Krukov avatar Krukov commented on May 27, 2024

So the second bug fixed #74

from cashews.

Krukov avatar Krukov commented on May 27, 2024

Fixed with 4.5.0

from cashews.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.