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

Storage accept callback for atomic operation #57

Open
h4kuna opened this issue Jul 18, 2019 · 7 comments
Open

Storage accept callback for atomic operation #57

h4kuna opened this issue Jul 18, 2019 · 7 comments

Comments

@h4kuna
Copy link
Contributor

h4kuna commented Jul 18, 2019

If i want implement apcu by IStorage then apcu has own atomic method, whose works fine. But interface of IStorage does not allow use callback for apcu_entry.

For this moment locking solves cache and i can't to use native lock from strorage. Same problem is with redis where in implementation is useful callback.

I understand this is probably BC break. I try to create implementation where i add new interfaces ISelfLock, ISimpleStorage and IStorage has still same api.

I made little test where files blocking concurrent processes while apcu with ISelfLock does not do it.

Here is other info (in czech)

@dg
Copy link
Member

dg commented Mar 31, 2020

Do you know how it works in Redis?

@h4kuna
Copy link
Contributor Author

h4kuna commented Mar 31, 2020

I didn't implement, but @forrest79 could you describe it?

@forrest79
Copy link

I think, that Redis is not corresponding to this issue. We just implemented passive locking via SETNX and BLPOP (something like this https://github.com/ionelmc/python-redis-lock in PHP) but it's sometimes crashed under heavy load.

@dg
Copy link
Member

dg commented Apr 1, 2020

So for redis is best solution lock() & release()

@forrest79
Copy link

I thing yes. But what is describing h4kuna can be really handy. On smaller sites, I'm using APCu as cache and I want to use build-in atomic fetch method, but it means, that I can't use Nette/Cache

@dg
Copy link
Member

dg commented Apr 1, 2020

I understand that, but I needed to verify info about Redis.

@forrest79
Copy link

I don't know about Redis cache/lock, that is not comatible with current Cache implementation.

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

3 participants