class Redis extends Driver (View source)

Properties

protected Redis $redis

Berisi instance database redis.

Methods

bool
has(string $key)

Cek apakah item ada di cache.

mixed
get(string $key, mixed $default = null)

Ambil sebuah item dari cache.

from  Driver
mixed
retrieve(string $key)

Ambil item dari driver cache.

put(string $key, mixed $value, int $minutes)

Simpan item ke cache untuk beberapa menit.

forever(string $key, mixed $value)

Simpan item ke cache untuk selamanya (atau 5 tahun).

mixed
remember(string $key, mixed $default, int $minutes, string $function = 'put')

Ambil item dari cache, atau taruh item tersebut ke cache dan return default value.

from  Driver
mixed
sear(string $key, mixed $default)

Anbil sebuah item dari cache, atau taruh item tersebut ke cache selamanya (atau 5 tahun).

from  Driver
forget(string $key)

Hapus item dari cache.

flush()

Hapus seluruhitem cache.

int
expiration(int $minutes)

Ambil waktu kedaluwarsa cache (dalam unix timestamp).

from  Driver
__construct(Redis $redis)

Buat instance driver redis baru.

Details

bool has(string $key)

Cek apakah item ada di cache.

Parameters

string $key

Return Value

bool

mixed get(string $key, mixed $default = null)

Ambil sebuah item dari cache.


     // Ambil sebuah item dari driver cache
     $name = Cache::driver('name');

     // Return default value jika item tidak ditemukan
     $name = Cache::get('name', 'Budi');

Parameters

string $key
mixed $default

Return Value

mixed

protected mixed retrieve(string $key)

Ambil item dari driver cache.

Parameters

string $key

Return Value

mixed

put(string $key, mixed $value, int $minutes)

Simpan item ke cache untuk beberapa menit.


     // Simpan sebuah item ke cache selama 15 menit.
     Cache::put('name', 'Budi', 15);

Parameters

string $key
mixed $value
int $minutes

forever(string $key, mixed $value)

Simpan item ke cache untuk selamanya (atau 5 tahun).

Parameters

string $key
mixed $value

mixed remember(string $key, mixed $default, int $minutes, string $function = 'put')

Ambil item dari cache, atau taruh item tersebut ke cache dan return default value.


     // Ambil sebuah item dari cache, atau taruh item tersebut ke cache selama 15 menit
     $name = Cache::remember('name', 'Budi', 15);

     // Gunakan closure sebagai value item cache
     $count = Cache::remember('count', function() { return User::count(); }, 15);

Parameters

string $key
mixed $default
int $minutes
string $function

Return Value

mixed

mixed sear(string $key, mixed $default)

Anbil sebuah item dari cache, atau taruh item tersebut ke cache selamanya (atau 5 tahun).

Parameters

string $key
mixed $default

Return Value

mixed

forget(string $key)

Hapus item dari cache.

Parameters

string $key

flush()

Hapus seluruhitem cache.

protected int expiration(int $minutes)

Ambil waktu kedaluwarsa cache (dalam unix timestamp).

Parameters

int $minutes

Return Value

int

__construct(Redis $redis)

Buat instance driver redis baru.

Parameters

Redis $redis