Homec4science

Add PhutilKeyValueCache and some implementations

Authored by epriestley <git@epriestley.com> on Nov 16 2012, 19:19.

Description

Add PhutilKeyValueCache and some implementations

Summary:
This is basically a slightly-more-abstract version of Facebook's cache stack, without any of the cachekey callbacks (in SocialBB, I implemented something similar above this).

  • PhutilKeyValueCache defines an abstract key-value cache interface with get/set/delete operations.
  • PhutilKeyValueCacheStack allows you to compose several caches so they behave like a single cache with readthrough semantics (like request -> APC -> Memcache at Facebook).

Then there are cache implementations:

  • PhutilKeyValueCacheAPC implements an APC-based cache.
  • PhutilKeyValueCacheMemcache implements a memcache-backed cache.
  • PhutilKeyValueCacheInRequest is like Facebook's $GLOBALS['CACHE'] (i.e., kind of a bad idea).
  • PhutilKeyValueCacheOnDisk implements a disk-based cache. With clever use of getmypid() / posix_getppid() and such we can reasonably fake something like APC for non-APC installs.

Test Plan: Ran unit tests. This is a slightly modified version of code that worked correctly in SocialBB.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2062

Differential Revision: https://secure.phabricator.com/D3974

Details

Committed
epriestley <git@epriestley.com>Nov 16 2012, 19:19
Pushed
aubortMar 17 2017, 12:03
Parents
rPHUdbec5db52d84: Statically link xhpast.exe
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHU5b705bf4f4db: Add PhutilKeyValueCache and some implementations (authored by epriestley <git@epriestley.com>).Nov 16 2012, 19:19