Classes

File io/data/store/DataStore.class.php

File io/data/store/DataStore.class.php

 1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 
<?php
/**
 * This interface represents a data store. Its different implementations store data in
 * different physical areas, you have to use it according to the data's life span and the efficiency
 * you need.
 * A container can store several pieces of data, each of one has a string identifier you choose. That
 * identifier must be a string with only letters and digits.
 * @package     IO
 * @subpackage  Data\store
 * @copyright   &copy; 2005-2019 PHPBoost
 * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0
 * @author      Benoit SAUTEL <ben.popeye@phpboost.com>
 * @version     PHPBoost 5.2 - last update: 2014 12 22
 * @since       PHPBoost 3.0 - 2009 12 09
*/

interface DataStore
{
    /**
     * Returns the data stored in the $id key.
     * @param string $id The key (must be a string with only letters and digits)
     * @return mixed The data that is stored
     * @throws DataStoreException If data cannot be found.
     */
    function get($id);

    /**
     * Tells whether the container contains the data at the key $id.
     * @param string $id The key
     * @return bool true if the container contains it, false otherwise
     */
    function contains($id);

    /**
     * Stores data.
     * @param string $id The key corresponding to what you store.
     * @param mixed $object The data you want to store
     */
    function store($id, $object);

    /**
     * Deletes the data you had stored.
     * @param string $id The key
     */
    function delete($id);

    /**
     * Clears all data
     */
    function clear();
}
?>