Stack.PHP
A simple and easy to use PHP library for the Stack Exchange API.
Public Member Functions | List of all members
CacheBase Interface Reference

Represents a means of caching API responses. More...

Inheritance diagram for CacheBase:
FilestoreCache SQLCache

Public Member Functions

 RetrieveFromCache ($url)
 Retrieves the data for the given URL from the cache. More...
 
 AddToCache ($url, $data, $ttl=null)
 Adds the URL and data to the cache. More...
 
 Clear ()
 Clears all entries from the cache.
 
 Cleanup ()
 Removes expired entries from the cache.
 

Detailed Description

Represents a means of caching API responses.

Note that some requests will disable the cache if the response contains authenticated data. This is done as a security precaution to prevent information leakage.

Member Function Documentation

◆ AddToCache()

CacheBase::AddToCache (   $url,
  $data,
  $ttl = null 
)

Adds the URL and data to the cache.

Parameters
$urlthe URL for the request
$datathe data for the URL
$ttlthe time-to-live (TTL) for the data

Implemented in FilestoreCache, and SQLCache.

◆ RetrieveFromCache()

CacheBase::RetrieveFromCache (   $url)

Retrieves the data for the given URL from the cache.

Parameters
$urlthe URL to retrieve the data for
Returns
the data for the URL or FALSE

Implemented in FilestoreCache, and SQLCache.


The documentation for this interface was generated from the following file: