Skip to content

Instantly share code, notes, and snippets.

@lukeholder
Created June 25, 2014 10:37
Show Gist options
  • Save lukeholder/a6e6956e787213e7604e to your computer and use it in GitHub Desktop.
Save lukeholder/a6e6956e787213e7604e to your computer and use it in GitHub Desktop.
class CellarSession implements \Cartalyst\Cart\Storage\StorageInterface
{
public function getKey()
{
return "cellar";
}
public function identify()
{
return "main_cart";
}
public function get()
{
craft()->httpSession->get($this->getSessionKey());
}
public function put($value)
{
craft()->httpSession->add($this->getSessionKey(), $value);
}
public function has()
{
craft()->httpSession->contains($this->getSessionKey());
}
public function forget()
{
craft()->httpSession->remove($this->getSessionKey());
}
protected function getSessionKey()
{
return "{$this->getKey()}.{$this->identify()}";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment