#7744 closed (fixed)
cache.add() should return result
Reported by: | qmanic | Owned by: | nobody |
---|---|---|---|
Component: | Core (Cache system) | Version: | dev |
Severity: | Keywords: | cache add | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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.
Attachments (1)
Change History (5)
by , 16 years ago
Attachment: | 7744-1.diff added |
---|
comment:1 by , 16 years ago
Has patch: | set |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:2 by , 16 years ago
milestone: | → post-1.0 |
---|
comment:3 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Whoops. I hadn't noticed this existed. I needed to fix this yesterday as a consequence of something else, so it was fixed in [8278].
Since the functionality of
add()
was based on memcached's implementation to begin with, it seems reasonable to do so here as well.