Code

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#7744 closed (fixed)

cache.add() should return result

Reported by: qmanic Owned by: nobody
Component: Core (Cache system) Version: master
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: UI/UX:

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)

7744-1.diff (4.5 KB) - added by mattmcc 6 years ago.

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by mattmcc

comment:1 Changed 6 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

Since the functionality of add() was based on memcached's implementation to begin with, it seems reasonable to do so here as well.

comment:2 Changed 6 years ago by mir

  • milestone set to post-1.0

comment:3 Changed 6 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to 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].

comment:4 Changed 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.