Overview

Namespaces

  • None
  • Wei
    • Validator

Classes

  • Apc
  • App
  • ArrayCache
  • Asset
  • Base
  • BaseCache
  • BaseController
  • Bicache
  • Cache
  • Config
  • Cookie
  • Couchbase
  • Counter
  • Db
  • DbCache
  • E
  • Env
  • Error
  • FileCache
  • Gravatar
  • Http
  • Lock
  • Logger
  • Memcache
  • Memcached
  • MongoCache
  • Password
  • PhpError
  • PhpFileCache
  • Pinyin
  • Record
  • Redis
  • Request
  • Response
  • Router
  • SafeUrl
  • Session
  • Soap
  • T
  • Ua
  • Upload
  • Url
  • Uuid
  • Validate
  • View
  • WeChatApp
  • Wei
  • Overview
  • Namespace
  • Class

Class Bicache

A two-level cache service

Wei\Base
Extended by Wei\BaseCache
Extended by Wei\Bicache
Namespace: Wei
Author: Twin Huang twinhuang@qq.com
Located at Bicache.php
Methods summary
public mixed
# get( string $key, integer $expire = null, callable $fn = null )

Retrieve an item

Retrieve an item

Parameters

$key
The name of item
$expire
The expire seconds of callback return value
$fn
The callback to execute when cache not found

Returns

mixed

Throws

RuntimeException
When set cache return false
public boolean
# set( string $key, mixed $value, integer $expire = 0 )

Store an item

Store an item

Parameters

$key
The name of item
$value
The value of item
$expire
The expire seconds, defaults to 0, means never expired

Returns

boolean
public boolean
# remove( string $key )

Remove an item

Remove an item

Parameters

$key
The name of item

Returns

boolean
public boolean
# exists( string $key )

Check if an item is exists

Check if an item is exists

Parameters

$key

Returns

boolean
public boolean
# add( string $key, mixed $value, integer $expire = 0 )

Add an item

Add an item

Parameters

$key
The name of item
$value
The value of item
$expire
The expire seconds, defaults to 0, means never expired

Returns

boolean
public boolean
# replace( string $key, mixed $value, integer $expire = 0 )

Replace an existing item

Replace an existing item

Parameters

$key
The name of item
$value
The value of item
$expire
The expire seconds, defaults to 0, means never expired

Returns

boolean
public integer|false
# incr( string $key, integer $offset = 1 )

Increment an item

Increment an item

Parameters

$key
The name of item
$offset
The value to increased

Returns

integer|false
Returns the new value on success, or false on failure
public boolean
# clear( )

Clear all items

Clear all items

Returns

boolean
protected boolean
# needUpdate( string $key )

Check if the key need to update to the slave cache

Check if the key need to update to the slave cache

Parameters

$key

Returns

boolean
Methods inherited from Wei\BaseCache
__invoke(), decr(), getFileContent(), getMulti(), getNamespace(), processGetResult(), setMulti(), setNamespace()
Methods inherited from Wei\Base
__call(), __construct(), __get(), getOption(), setOption()
Properties summary
protected array $providers
# array( 'master' => 'apc', 'slave' => 'fileCache', )
protected integer $time

The seconds to update the slave cache

The seconds to update the slave cache

# 5
Properties inherited from Wei\BaseCache
$namespace
Properties inherited from Wei\Base
$wei
Magic properties summary
public Wei\BaseCache $master

The master(faster) cache service

public Wei\BaseCache $slave

The slave(slower) cache service

Wei Framework API documentation generated by ApiGen