ICache

interface OCP\ICache
This interface defines method for accessing the file based user cache.
Implemented by:OC\Cache\CappedMemoryCache OC\Cache\File OC\Memcache\Cache
Source:lib/public/ICache.php#42

Methods

public OCP\ICache::get($key)
Get a value from the user cache
Source:

lib/public/ICache.php#50

Parameters:
  • $key (string)
Returns:

mixed

Since:

6.0.0

public OCP\ICache::set($key, $value, $ttl=0)
Set a value in the user cache
Source:

lib/public/ICache.php#60

Parameters:
  • $key (string)
  • $value (mixed)
  • $ttl (int) Time To Live in seconds. Defaults to 60*60*24
Returns:

bool

Since:

6.0.0

public OCP\ICache::hasKey($key)
Check if a value is set in the user cache
Source:

lib/public/ICache.php#69

Parameters:
  • $key (string)
Returns:

bool

Since:

6.0.0

Deprecated:

9.1.0 Directly read from GET to prevent race conditions

public OCP\ICache::remove($key)
Remove an item from the user cache
Source:

lib/public/ICache.php#77

Parameters:
  • $key (string)
Returns:

bool

Since:

6.0.0

public OCP\ICache::clear($prefix="")
Clear the user cache of all entries starting with a prefix
Source:

lib/public/ICache.php#85

Parameters:
  • $prefix (string) (optional)
Returns:

bool

Since:

6.0.0