Cache

Joomla! Cache base object

since

1.7.0

package

Joomla CMS

Methods

__construct

Constructor

__construct(mixed||string|int options) : 
since

1.7.0

Arguments

options

array<string|int, mixed>Cache options

Response

mixed

_getStorage

Get the cache storage handler

_getStorage() : \Joomla\CMS\Cache\CacheStorage
since

1.7.0

Response

CacheStorage

addIncludePath

Add a directory where Cache should search for handlers. You may either pass a string or an array of directories.

addIncludePath(array|string path = '') : mixed||string|int
static
since

1.7.0

Arguments

path

array<string|int, mixed>|stringA path to search.

Response

array<string|int, mixed>An array with directory elements

clean

Clean cache for a group given a mode.

clean( group = null,  mode = 'group') : 

group mode : cleans all cache in the group notgroup mode : cleans all cache not in the group

since

1.7.0

Arguments

group

stringThe cache data group

mode

stringThe mode for cleaning cache [group|notgroup]

Response

boolTrue on success, false otherwise

contains

Check if the cache contains data stored by ID and group

contains( id,  group = null) : 
since

3.7.0

Arguments

id

stringThe cache data ID

group

stringThe cache data group

Response

bool

gc

Garbage collect expired cache data

gc() : 
since

1.7.0

Response

bool

get

Get cached data by ID and group

get( id,  group = null) : 
since

1.7.0

Arguments

id

stringThe cache data ID

group

stringThe cache data group

Response

mixedBoolean false on failure or a cached data object

getAll

Get a list of all cached data

getAll() : 
since

1.7.0

Response

mixedBoolean false on failure or an object with a list of cache groups and data

getCaching

Get caching state

getCaching() : 
since

1.7.0

Response

bool

getInstance

Returns a reference to a cache adapter object, always creating it

getInstance( type = 'output', mixed||string|int options = []) : \Joomla\CMS\Cache\CacheController
static deprecated
since

1.7.0

deprecated

4.2 will be removed in 6.0 Use the cache controller factory instead Example: Factory::getContainer()->get(CacheControllerFactoryInterface::class)->createCacheController($type, $options);

Arguments

type

stringThe cache object type to instantiate

options

array<string|int, mixed>The array of options

Response

CacheController

getPlatformPrefix

Set a prefix cache key if device calls for separate caching

getPlatformPrefix() : 
static
since

3.5

Response

string

getStores

Get the storage handlers

getStores() : mixed||string|int
static
since

1.7.0

Response

array<string|int, mixed>

getWorkarounds

Perform workarounds on retrieved cached data

getWorkarounds(mixed||string|int data, mixed||string|int options = []) : 
static
since

1.7.0

Arguments

data

array<string|int, mixed>Cached data

options

array<string|int, mixed>Array of options

Response

stringBody of cached data

lock

Set lock flag on cached item

lock( id,  group = null,  locktime = null) : \stdClass
since

1.7.0

Arguments

id

stringThe cache data ID

group

stringThe cache data group

locktime

stringThe default locktime for locking the cache.

Response

stdClassObject with properties of lock and locklooped

makeId

Create a safe ID for cached data from URL parameters

makeId() : 
static
since

1.7.0

Response

stringMD5 encoded cache ID

remove

Remove a cached data entry by ID and group

remove( id,  group = null) : 
since

1.7.0

Arguments

id

stringThe cache data ID

group

stringThe cache data group

Response

bool

setCaching

Set caching enabled state

setCaching( enabled) : 
since

1.7.0

Arguments

enabled

boolTrue to enable caching

Response

void

setLifeTime

Set cache lifetime

setLifeTime( lt) : 
since

1.7.0

Arguments

lt

intCache lifetime in minutes

Response

void

setWorkarounds

Create workarounds for data to be cached

setWorkarounds( data, mixed||string|int options = []) : mixed||string|int
static
since

1.7.0

Arguments

data

stringCached data

options

array<string|int, mixed>Array of options

Response

array<string|int, mixed>Data to be cached

store

Store the cached data by ID and group

store( data,  id,  group = null) : 
since

1.7.0

Arguments

data

mixedThe data to store

id

stringThe cache data ID

group

stringThe cache data group

Response

bool

unlock

Unset lock flag on cached item

unlock( id,  group = null) : 
since

1.7.0

Arguments

id

stringThe cache data ID

group

stringThe cache data group

Response

bool

Properties

_handler

Storage handler

static
since

1.7.0

Type(s)

array<string|int, CacheStorage>

_options

Cache options

since

1.7.0

Type(s)

array<string|int, mixed>