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

ERR by redis : RedisCache.upsert() got an unexpected keyword argument 'lock' #1909

Closed
songjinu opened this issue May 16, 2024 · 6 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@songjinu
Copy link

Describe the bug
I got a error when use redis cache.

RedisCache.upsert() got an unexpected keyword argument 'lock'
I setted env : LANGFLOW_CACHE_TYPE= redis

  • tested tag : v1.0.0a32
Error checking build status: RedisCache.upsert() got an unexpected keyword argument 'lock'
Copy link

dosubot bot commented May 16, 2024

The issue you're experiencing with the RedisCache.upsert() method not accepting a lock argument is due to the method's implementation in the RedisCache class, which indeed does not support a lock parameter. This contrasts with the implementations in other cache classes that might accept such an argument.

To resolve this error, you should remove the lock keyword argument from your call to the upsert method when using RedisCache. This adjustment will align your usage with the expected method signature and functionality, effectively eliminating the error.

For reference, the upsert method in RedisCache is designed to insert or update a value in the cache, with special handling for merging dictionaries if both the existing and new values are dictionaries. It does not include or require a lock parameter for its operation.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@dosubot dosubot bot added the bug Something isn't working label May 16, 2024
@songjinu
Copy link
Author

songjinu commented Jun 9, 2024

I used to LANGFLOW_CACHE_TYPE= redis on 0.6.17.
I am in 1.0.0a44 now.
I have to use multi process (uvicone --worker) ,because I have many user.
I need to use independent cache like RedisCache.
please help~

Copy link

dosubot bot commented Jun 9, 2024

To configure and use RedisCache correctly in a multi-process environment with version 1.0.0a44, you should ensure that you are not using the lock argument with the upsert() method, as it does not accept this argument. Here is an example of how you can configure and use RedisCache:

from langflow.services.cache.service import RedisCache

# Initialize the RedisCache
cache = RedisCache(host="localhost", port=6379, db=0, expiration_time=3600)

# Check if the Redis client is connected
if cache.is_connected():
    print("Connected to Redis")

# Setting cache values
cache.set("a", 1)
cache.set("b", 2)
cache["c"] = 3

# Getting cache values
a = cache.get("a")
b = cache["b"]
print(f"a: {a}, b: {b}")

# Upserting cache values
cache.upsert("a", {"new_key": "new_value"})
print(f"Updated a: {cache.get('a')}")

# Deleting a cache value
cache.delete("a")
print(f"a after deletion: {cache.get('a')}")

# Clearing the cache
cache.clear()
print(f"Cache after clearing: {list(cache._client.keys())}")

This example demonstrates how to initialize the RedisCache, set and get values, upsert values, delete values, and clear the cache. The upsert method is used without a lock argument, as required. Note that RedisCache is an experimental feature and may not work as expected, so please report any issues to the GitHub repository [1][2][3].

Additionally, Redis operations are atomic, ensuring data consistency in a multi-process environment. However, be aware that RedisCache is experimental and may have limitations or issues in such environments [1].

To continue talking to Dosu, mention @dosu.

@anovazzi1
Copy link
Contributor

Hello,
Sorry for the delay. Did you try using the new version? Does the error still persist?

@carlosrcoelho
Copy link
Contributor

Hi @songjinu,


I hope you're doing well. Just a friendly reminder that if we do not hear back from you within the next 3 days, we will close this issue. If you need more time or further assistance, please let us know.


Thank you for your understanding!

@carlosrcoelho carlosrcoelho self-assigned this Jul 22, 2024
@carlosrcoelho
Copy link
Contributor

Thank you for your contribution! This issue will be closed. If you have any questions or encounter another problem, please open a new issue and we will be ready to assist you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants