# \cge_datastore

This class implements a simple key/value store utilizing the database intended for storing small amounts of temporary data that must survive both the request, and the session but can have a limited lifetime.

Each entry can have up to 3 cascading keys. It features automatic deletion of expired keys.

## Summary

Methods
Properties
Constants
__construct()
set_expiry()
remove_expired()
erase()
store()
get()
listall()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

File
  lib/class.cge_datastore.php
Package
  \CGExtensions
Class hierarchy
  \cge_datastore

## Tags

todo |

## Methods

### __construct()

    __construct(int $expiry)

Construct a new datastore object.

#### Parameters

int | $expiry | The amount of time until values stored with this object will expire. Minimum of 30 seconds.

#

## Tags

todo |

### set_expiry()

    set_expiry(int $num)

Adjust the expiry of data stored with this object.

#### Parameters

int | $num | The amount of time until values stored with this object will expire. Minimum of 30 seconds.

#

## Tags

todo |

### remove_expired()

    remove_expired()

Remove all expired entries from the database.

This method will return all expired entries from the database, regardless of whether they were stored with this instance or not.

#

## Tags

todo |

### erase()

    erase(string $key1, string $key2, string $key3, string $key4)

Erase the specified data from the database

#### Parameters

string | $key1 |
string | $key2 | An optional additional key that is combined with key1
string | $key3 | An optional additional key that is combined with key1 and key2
string | $key4 | An optional additional key that is combined with key1, key2, and key3

#

## Tags

todo |

### store()

    store(mixed $data, string $key1, string $key2, string $key3, string $key4)

Store the specified data into the database

#### Parameters

mixed | $data |
string | $key1 |
string | $key2 | An optional additional key that is combined with key1
string | $key3 | An optional additional key that is combined with key1 and key2
string | $key4 | An optional additional key that is combined with key1, key2, and key3

#

## Tags

todo |

### get()

    get(string $key1, string $key2, string $key3, string $key4) : mixed

Retrieve the specified data from the database

#### Parameters

string | $key1 |
string | $key2 | An optional additional key that is combined with key1
string | $key3 | An optional additional key that is combined with key1 and key2
string | $key4 | An optional additional key that is combined with key1, key2, and key3

#### Returns

mixed

#

## Tags

todo |

### listall()

    listall(string $key1, string $key2, string $key3) : array

List all of the data matching the specified keys.

The fiewer keys specified should result in more matches.

#### Parameters

string | $key1 |
string | $key2 | An optional additional key that is combined with key1
string | $key3 | An optional additional key that is combined with key1 and key2

#### Returns

array

#

## Tags

todo |

### class.cge_datastore.php