CachedJson
        
        extends CachedFile
    
    
            
            in package
            
        
    
    
    
Class to manage cached JSON-based files.
Tags
Table of Contents
Properties
- $directory : string
- $filename : string
- $cache_days_ttl : int
Methods
- __construct() : mixed
- Initialized a CachedFile object with an associated file location
- get_age() : int
- Get cache age in days (how days old is the cache file)
- get_path() : string
- Get the cached file path
- is_old() : bool
- Return TRUE if the cache is old
- load() : mixed
- Load the cached JSON file as JSON-like object
- store() : mixed
- Write/Overwrite the cached file with a new JSON.
Properties
$directory
    public
    static    string
    $directory
    
    
    
    
$filename
    public
    static    string
    $filename
    
    
    
    
$cache_days_ttl
    protected
        int
    $cache_days_ttl
     = 1
    
    
    
Methods
__construct()
Initialized a CachedFile object with an associated file location
    public
                    __construct(string $directory, string $filename, mixed $init_content) : mixed
    Parameters
- $directory : string
- 
                    the directory containing the cached file. 
- $filename : string
- 
                    the name of the cached file. 
- $init_content : mixed
- 
                    initial content of the cached file. 
Tags
get_age()
Get cache age in days (how days old is the cache file)
    public
                    get_age() : int
    Tags
Return values
int —the cache age in days.
get_path()
Get the cached file path
    public
                    get_path() : string
    Tags
Return values
string —the cached file path.
is_old()
Return TRUE if the cache is old
    public
                    is_old() : bool
    Return TRUE if the cache age in days is more than the cache TTL specified for the class.
Tags
Return values
bool —TRUE if the cache is old.
load()
Load the cached JSON file as JSON-like object
    public
                    load() : mixed
    Tags
Return values
mixed —the cached JSON file as JSON-like object.
store()
Write/Overwrite the cached file with a new JSON.
    public
                    store(mixed $content) : mixed
    Parameters
- $content : mixed
- 
                    the JSON-like object to cache.