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

About hash cache #4

Open
Darr-en1 opened this issue Sep 11, 2019 · 0 comments
Open

About hash cache #4

Darr-en1 opened this issue Sep 11, 2019 · 0 comments

Comments

@Darr-en1
Copy link

Object data from the local cache is inconsistent

for example

class SiteObject(models.Model):
    name = models.CharHash()

site1 = SiteObject(pk="site_pk_1")
site2 = SiteObject(pk="site_pk_1")
site1.name="pig"
print(site1.name)
site1.name = "cat"
print(site1.name)
print(site2.name)
site2.name="dog"
print(site2.name)
print(site1.name)

output

pig
cat
cat
dog
cat

As shown above, when site1.name is called, the data in redis is retrieved and stored in the site1 self._astra_hash object, so is site2, Therefore, the query of site1 will not be affected after the change of site2

Redis is so fast, I think the design might need to be rethought

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant