<?php

namespace App\Core\Cache;

use \App\Core\Template\Output as Output;
use \App\Core\Cache\Classes\Cache as Cache;
use RR\Response;

class CacheController extends \DefaultController
{

    protected $_class   = Cache::class;
    protected $_baseUrl = '/cache';

    /**
     * Index
     *   Show the main Cache list
     */
    function index()
    {
        Output::render('index', array('list' => Cache::findAll()));
    }

    /**
     * Create
     *
     * Render the main Cache formulary
     */
    function create()
    {
        Output::render('form', ['id' => 0]);
    }

    /**
     * Store
     *
     * Store the param on the database
     * @param Cache $cache
     */
    function store(Cache $cache)
    {
    }

    /**
     * Search
     *
     * Store the param on the database
     * @param Cache $cache
     */
    function search()
    {
    }

    /**
     * Show
     *
     * Render one register
     *
     * @param Cache $cache
     */
    function show(Cache $cache)
    {
        Response::json(stripslashes($cache->value))->send();
    }

    /**
     * Edit
     *
     * Render the formular for a database Cache
     *
     * @param Cache $cache
     */
    function edit(Cache $cache)
    {
        Output::render('form', $cache);
    }

    /**
     * Update
     * Store the changes of the param on the database
     *
     * @param Cache $cache
     */
    function update(Cache $cache)
    {
    }

    /**
     * Destroy
     * If the object has soft delete.
     *
     * @param Cache $cache
     */
    function destroy(Cache $cache)
    {
    }

    /**
     * Purge
     * Remove object even with soft delete.
     *
     * @param Cache $cache
     */
    function purge(Cache $cache)
    {
    }
}
