L
L
LINKeR UA2015-09-03 15:06:40
Kohana
LINKeR UA, 2015-09-03 15:06:40

Kohana framework. How to cache a route?

Suppose we have N routes.
And I need to cache:
- 5 whole file emulation routes with a lifetime of 7 days. (see ***)
- 2 full file emulation routes with a lifetime of 1 days. (see ***)
- defined select requests in their entirety with a lifetime of 2 hours. (see ***)
- defined select requests in their entirety with a lifetime of 12 hours. (see ***)
***Preferably with the ability to specify a limit on the amount of file cache storage
Which of the above can be implemented using standard Kohana Framework 3.3.3 tools, and what will you have to do yourself?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Belyaev, 2015-09-03
@LINKeRxUA

Kohana has a standard simple route caching mechanism, but you can override the method Route::cache()and add your own functionality

if ( ! Route::cache())
{
    // роуты
    Route::set('routename', 'foo/bar');

    if (Kohana::$environment === Kohana::PRODUCTION)
        Route::cache(true);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question