Overview

Namespaces

  • Composer
    • Autoload
  • Geekwright
    • RegDom
  • League
    • OAuth2
      • Client
        • Provider
  • None
  • Xmf
    • Database
    • Jwt
    • Key
    • Module
      • Helper

Classes

  • AbstractHelper
  • Cache
  • GenericHelper
  • Permission
  • Session
  • Overview
  • Namespace
  • Class
  • Tree

Class Cache

Manage cache interaction in a module. Cache key will be prefixed with the module name to segregate it from keys set by other modules or system functions. Cache data is by definition serialized, so any arbitrary data (i.e. array, object) can be stored.

Xmf\Module\Helper\AbstractHelper
Extended by Xmf\Module\Helper\Cache
Namespace: Xmf\Module\Helper
Package: Xmf
Category: Xmf\Module\Helper\Cache
Copyright: 2011-2016 XOOPS Project (http://xoops.org)
License: GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
Author: trabis lusopoemas@gmail.com
Author: Richard Griffith richard@geekwright.com
Link: http://xoops.org
Located at lass/libraries/vendor/xoops/xmf/src/Xmf/Module/Helper/Cache.php
Methods summary
public
# init( )

Initialize parent::__construct calls this after verifying module object.

Initialize parent::__construct calls this after verifying module object.

protected string
# prefix( string $name )

Add our module prefix to a name

Add our module prefix to a name

Parameters

$name
name to prefix

Returns

string
module prefixed name
public boolean
# write( string $key, mixed $value, integer|null $ttl = null )

Write a value for a key to the cache

Write a value for a key to the cache

Parameters

$key
Identifier for the data
$value
Data to be cached - anything except a resource
$ttl
Time to live in seconds

Returns

boolean
True if the data was successfully cached, false on failure
public mixed
# read( string $key, mixed $default = false )

Read value for a key from the cache

Read value for a key from the cache

Parameters

$key
Identifier for the data
$default
default value to return if config $key is not set

Returns

mixed
value if key was set, false not set or expired
public
# delete( string $key )

Delete a key from the cache

Delete a key from the cache

Parameters

$key
Identifier for the data
public mixed
# cacheRead( string $key, callable $regenFunction, integer|null $ttl = null, mixed $args = null )

cache block wrapper

cache block wrapper

If the cache read for $key is a miss, call the $regenFunction to update it.

Parameters

$key
Identifier for the cache item
$regenFunction
function to generate cached content
$ttl

time to live, number of seconds as integer or null for default

$args
variable argument list for $regenFunction

Returns

mixed
Methods inherited from Xmf\Module\Helper\AbstractHelper
__construct(), addLog(), setDebug()
Properties summary
protected string $prefix
#
protected XoopsCache $cache
#
Properties inherited from Xmf\Module\Helper\AbstractHelper
$debug, $module
API documentation generated by ApiGen