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#40

Methods

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

lib/public/ICache.php#48

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#58

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#67

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#75

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#83

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

bool

Since:

6.0.0