Code

Opened 6 years ago

Closed 6 years ago

#6590 closed (wontfix)

Change cache.add to cache.setdefault

Reported by: dcramer Owned by: nobody
Component: Core (Cache system) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Proposal of changing .add to .setdefault before it is adopted. Reason being is consistency.

.add has no clear meaning vs .set
.setdefault is already used for dictionaries
.setdefault clearly states what its doing vs .set

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

Not worth the pain this would cause for everybody using the low-level caching API. "Add" adds a new thing to the cache. The add/set API also corresponds neatly with memcached's API, which is a good idea, since serious caching is going to use memcached and people who are familiar with that shouldn't suddenly have the words changed when looking at a language binding API.

"Setdefault" is a fairly clunky term the way it is used in Python, because it does a lot more than set a default. So using it for other APIs is probably not a good idea.

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.