Opened 17 years ago

Closed 17 years ago

#6590 closed (wontfix)

Change cache.add to cache.setdefault

Reported by: David Cramer Owned by: nobody
Component: Core (Cache system) Version: dev
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

Change History (1)

comment:1 by Malcolm Tredinnick, 17 years ago

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top