Limit cache location to be in memory or in a default location.
Review Request #6648 — Created Nov. 26, 2014 and submitted — Latest diff uploaded
The HTTP cache for the API now takes a parameter that determines if it
is created in memory (create_db_in_memory
). This parameter replaces
thedb_path
parameter, which previously accepted the special value
':memory:'
to create the SQLite database in memory. The new
parameter is more straightforward because caches will only ever be
required to be created at the default location (for normal operation)
or in memory (for unit testing).The default API cache path is stored on the
APICache
class as the
CACHE_PATH
constant, which can be used without instantiating the
class. Becuase the HTTP cache for the API is only ever stored in one
location on disk, it can be cleared (i.e., unlinked) without
instantiating the class to determine where it is located on disk. This
is important in the case where the cache exists but has become corrupt
and cannot be loaded (and so instantiation of the APICache class will
fail).
Unit tests pass.