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 Couchbase

A cache service that stored data in Couchbase

Wei\Base
Extended by Wei\BaseCache
Extended by Wei\Couchbase
Namespace: Wei
Author: Twin Huang twinhuang@qq.com
Link: https://github.com/couchbase/php-ext-couchbase
Located at Couchbase.php
Methods summary
public
# __construct( array $options = array() )

Constructor

Constructor

Parameters

$options

Throws

InvalidArgumentException
When option "wei" is not an instance of "Wei\Wei"

Overrides

Wei\Base::__construct()
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

Throws

CouchbaseServerException
when flush is disabled for the bucket

Link

http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-admin-web-console-data-buckets-createedit.html
http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-admin-cli-flushing.html
public array
# getMulti( array $keys )

Retrieve multiple items

Retrieve multiple items

Parameters

$keys
The name of items

Returns

array

Overrides

Wei\BaseCache::getMulti()
public array
# setMulti( array $items, integer $expire = 0 )

Store multiple items

Store multiple items

Parameters

$items
$keys The name of items
$expire

Returns

array

Overrides

Wei\BaseCache::setMulti()
public Couchbase
# getObject( )

Get couchbase object

Get couchbase object

Returns

Couchbase
public
# setObject( Wei\Couchbase $object )

Set couchbase object

Set couchbase object

Parameters

$object

Returns


$this
Methods inherited from Wei\BaseCache
__invoke(), decr(), getFileContent(), getNamespace(), processGetResult(), setNamespace()
Methods inherited from Wei\Base
__call(), __get(), getOption(), setOption()
Properties summary
protected array|string $hosts

An array of hostnames[:port] where the Couchbase cluster is running. The port number is optional (and only needed if you're using a non-standard port).

An array of hostnames[:port] where the Couchbase cluster is running. The port number is optional (and only needed if you're using a non-standard port).

# '127.0.0.1:8091'
protected string $user

The username used for authentication to the cluster

The username used for authentication to the cluster

#
protected string $password

The password used to authenticate to the cluster

The password used to authenticate to the cluster

#
protected string $bucket

The name of the bucket to connect to

The name of the bucket to connect to

# 'default'
protected boolean $persistent

If a persistent object should be used or not

If a persistent object should be used or not

# true
protected Couchbase $object

The couchbase object

The couchbase object

#
Properties inherited from Wei\BaseCache
$namespace
Properties inherited from Wei\Base
$providers, $wei
Wei Framework API documentation generated by ApiGen