<?php
namespace Engine\Storage;
// TODO: if this doesn't get used in 6-12 months, remove this, added @Aug 28, 2014 by Lucian Sirbu

/**
 * Class used to save data to a persistent storage
 * @author Lucian Sirbu
 */
class LocalMemory implements \Engine\Storage\BaseInterface
{
	private $data = [];

	/**
	 * The class constructor.
	 */
	public function __construct()
	{
	}

	/**
	 * (non-PHPdoc)
	 * @see \Engine\Storage\BaseInterface::set()
	 */
	public function set($key, $value, $expireTime=0)
	{
		$this->data[$key] = $value;
		return true;
	}

	/**
	 * (non-PHPdoc)
	 * @see \Engine\Storage\BaseInterface::get()
	 */
	public function get($key)
	{
		return $this->data[$key];
	}

	/**
	 * (non-PHPdoc)
	 * @see \Engine\Storage\BaseInterface::delete()
	 */
	public function delete($key)
	{
		unset($this->data[$key]);
		return true;
	}

	/**
	 * (non-PHPdoc)
	 * @see \Engine\Storage\BaseInterface::flush()
	 */
	public function flush()
	{
		$this->data = [];
		return true;
	}

	/**
	 * (non-PHPdoc)
	 * @see \Engine\Storage\BaseInterface::getInfo()
	 */
	public function getInfo($key)
	{
		return [];
	}
}
