TOP

Mobi_Mtld_DA_CacheProvider_MemCacheProvider

Memcache cache provider may be used by the DeviceApi and DeviceApiWeb to cache the detected properties. Using cache improves the performance by not doing unnecessary lookups in the data files.
Source
MemCacheProvider.php
Implements
Mobi_Mtld_DA_CacheProvider_CacheProviderInterface
Depends on
Memcache
Exception
Package
Mobi\Mtld\DA\Device\CacheProvider
Author
DeviceAtlas Limited

Methods

__construct

Mobi_Mtld_DA_CacheProvider_MemCacheProvider $obj = new Mobi_Mtld_DA_CacheProvider_MemCacheProvider(
    int cacheItemExpiry=86400,
    string host=localhost,
    int port=11211,
    bool pconnect=false
)

Construct a CacheProvider object.

Arguments

    cacheItemExpiry=86400 (int)
    number of seconds before a cache item is expired
    host=localhost (string)
    memcache host
    port=11211 (int)
    memcache host port
    pconnect=false (bool)
    true=persistent connection

Returns

void

clear

bool $obj->clear()

Clear the whole cache.

Returns

bool
true=cache cleared

delete

bool $obj->delete(string key)

Remove an item from the cache.

Arguments

    key (string)
    cache key

Returns

bool
true=cache deleted

get

mixed $obj->get(string key)

Get a stored value form cache.

Arguments

    key (string)
    cache key

Returns

mixed
the cached value or null if the key does not exist in cache

set

bool $obj->set(string key)

Store a value in cache.

Value
mixed value value to be set to the cache key

Arguments

    key (string)
    cache key

Returns

bool
true=cache stored