1. Go to this page and download the library: Download beep/cachoid library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
beep / cachoid example snippets
\Beep\Cachoid\CachoidServiceProvider::class,
'Cachoid' => Beep\Cachoid\Facade::class,
namespace App;
use Beep\Cachoid\Cacheable;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
use Cacheable;
}
namespace App;
use Beep\Cachoid\Cacheable;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
use Cacheable;
/**
* Get the identifier to cache as.
*
* @return mixed
*/
public function cacheableAs()
{
return $this->getKey();
}
}
$user = $cachoid->eloquent()->withName(User::class)->identifiedBy(1)->remember(15, function () {
return User::find(1);
});
$user = $cachoid->eloquent(User::class, 1)->remember(15, function () {
return User::find(1);
});
$paginator = $cachoid->paginator(User::class)->remember(15, function () {
return User::paginate();
});
$paginator = $cachoid->paginator(User::class)->onPage(1)->showing(15)->remember(15, function () {
return User::paginate();
});