cache.add() should return result
|Reported by:||qmanic||Owned by:||nobody|
|Component:||Core (Cache system)||Version:||master|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently, cache.add() doesn't have a documented return type and for most backends doesn't return anything useful.
I think it should return something, though I'm unsure as to what. For example, in the memcached libraries we call, add() returns True or False depending on whether the key gets added or not.
One of the reasons behind this is so that locking can be emulated through the cache with a single add() call. Currently you'd have to add() some unique value, then get() it back out and compare the values.
Change History (5)
Changed 8 years ago by mattmcc
comment:1 Changed 8 years ago by mattmcc
- Has patch set
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Design decision needed
comment:3 Changed 8 years ago by mtredinnick
- Resolution set to fixed
- Status changed from new to closed