enonic / lib-cache

Cache Library for Enonic XP.
Apache License 2.0
2 stars 1 forks source link

Implement update function #8

Closed ComLock closed 5 years ago

ComLock commented 5 years ago

I have some cool code that uses getActiveVersion to make sure the cache is always uptodate.

If the node has changed I need to do two things:

  1. remove(key)
  2. get(key, fn)

I would like a update(key, fn) function that would overwrite the cache. Perhaps it could be optimized because it does not need to check wether key already exists.

GlennRicaud commented 5 years ago

Not recommended. Better to just invalidate and get.

Also the current implementation of this issue can cause problems (race condition). To be reverted