Class LegiScan_Cache_File
LegiScan API File Cache Class
Basic file caching with expirations to cache API responses and build permanent local bill text / document storage. To generate the path fragment under each respective cache directories use LegiScan_Pull::getCacheFilename() or LegiScan_Process::getCacheFilename().
API cache
As a dynamic API cache this stores pull API requests and search results in a local directory structure if there are no errors and subsequent calls to the same API hook will replay.
Directory structure where {api_dir}
is from LegiScan::getConfig('api_dir')
{api_dir}/amendment/AMENDMENT_ID.json
{api_dir}/bill/BILL_ID.json
{api_dir}/masterlist/SESSION_ID.json
{api_dir}/people/PEOPLE_ID.json
{api_dir}/rollcall/ROLL_CALL_ID.json
{api_dir}/search/SEARCH_GUID.json
{api_dir}/sessionlist/STATE.json
{api_dir}/supplement/SUPPLEMENT_ID.json
{api_dir}/text/TEXT_ID.json
Document cache
As a static document cache this is the basis for local storage of related documents (bill texts, amendments, supplements) as a well structured archive that can be easily accessed by humans and automation.
Directory structure TYPE/STATE/SESSION_ID/BILL_NUMBER/ID/MIME_EXT
where {doc_dir}
is from LegiScan::getConfig('doc_dir')
{doc_dir}/amendment/tx/1478/hb1/3928402/pdf
{doc_dir}/supplement/md/1412/sb493/56768/pdf
{doc_dir}/text/ca/1400/sb1/1439083/html
Copyright: 2010-2020 LegiScan LLC
License: https://opensource.org/licenses/BSD-2-Clause
Author: LegiScan API Team api@legiscan.com
See: LegiScan_Pull::getCacheFilename
See: LegiScan_Process::getCacheFilename
Link: https://api.legiscan.com/dl/
Located at LegiScan.php
public
|
|
public
mixed
|
|
public
boolean
|
|
public
boolean
|
integer |
TYPE_API
Type - API (expiration) |
#
1
|
integer |
TYPE_DOC
Type - Document (permanent) |
#
2
|
integer |
LIFETIME
Default lifetime of API cache objects in seconds (60 minutes) |
#
3600
|
private
|
$lifetime
Lifetime of API cache objects |
|
private
|
$cache_type
Type of cache |
|
private
|
$cache_dir
Base directory for cached files |