Search code examples
model-view-controllercachingsearchpaginationkohana

cache or session in a search form


I'd like to cache my search conditions which collected from a post form.Just like age >20 or gender is male. Then I can get the search right soon when I click next page if I use a pagination. But I am puzzled at work in an php mvc framework kohana 3.2. who can give me a demo?


Solution

  • Have a look at the Session class:

    Session::instance()->set($key, $value);
    
    $value = Session::instance()->get($key);
    if ($value) {
        // do something with the value
    }