caching icon indicating copy to clipboard operation
caching copied to clipboard

Storage accept callback for atomic operation

Open h4kuna opened this issue 6 years ago • 7 comments

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)

h4kuna avatar Jul 18 '19 07:07 h4kuna

Do you know how it works in Redis?

dg avatar Mar 31 '20 16:03 dg

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

h4kuna avatar Mar 31 '20 16:03 h4kuna

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.

forrest79 avatar Apr 01 '20 11:04 forrest79

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

dg avatar Apr 01 '20 11:04 dg

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

forrest79 avatar Apr 01 '20 12:04 forrest79

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

dg avatar Apr 01 '20 13:04 dg

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

forrest79 avatar Apr 01 '20 13:04 forrest79