PHP Class Jenner\SimpleFork\Cache\SharedMemory

Inheritance: implements Jenner\SimpleFork\Cache\CacheInterface
Show file Open project: huyanping/simple-fork-php

Protected Properties

Property Type Description
$client_count_key string shared memory ipc key
$shm resource holds shared memory resource
$size integer memory size

Public Methods

Method Description
__construct ( integer $size = 33554432, string $file = __FILE__ )
__wakeup ( ) init when wakeup
attach ( string $file = __FILE__ ) connect shared memory
delete ( $key ) : boolean delete var
dettach ( ) : boolean
get ( $key, null $default = null ) : boolean | mixed get var
has ( $key ) : boolean has var ?
remove ( ) : boolean remove shared memory.
set ( $key, $value ) : boolean set var
shm_key ( $val ) : mixed generate shm key

Method Details

__construct() public method

public __construct ( integer $size = 33554432, string $file = __FILE__ )
$size integer memory size
$file string

__wakeup() public method

init when wakeup
public __wakeup ( )

attach() public method

connect shared memory
public attach ( string $file = __FILE__ )
$file string

delete() public method

delete var
public delete ( $key ) : boolean
$key
return boolean

dettach() public method

public dettach ( ) : boolean
return boolean

get() public method

get var
public get ( $key, null $default = null ) : boolean | mixed
$key
$default null
return boolean | mixed

has() public method

has var ?
public has ( $key ) : boolean
$key
return boolean

remove() public method

you should know that it maybe does not work.
public remove ( ) : boolean
return boolean

set() public method

set var
public set ( $key, $value ) : boolean
$key
$value
return boolean

shm_key() public method

generate shm key
public shm_key ( $val ) : mixed
$val
return mixed

Property Details

$client_count_key protected property

shared memory ipc key
protected string $client_count_key
return string

$shm protected property

holds shared memory resource
protected resource $shm
return resource

$size protected property

memory size
protected int $size
return integer