Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheEntry ¶
type CacheEntry[V any] struct { // contains filtered or unexported fields }
type CacheManager ¶
type CacheManager[V any] struct { // contains filtered or unexported fields }
CacheManager mengelola semua item cache
func NewCacheManager ¶
func NewCacheManager[V any]() *CacheManager[V]
NewCacheManager membuat instance CacheManager baru
func (*CacheManager[V]) Forget ¶
func (cm *CacheManager[V]) Forget(key string)
Forget menghapus item dari cache
func (*CacheManager[V]) Remember ¶
func (cm *CacheManager[V]) Remember(key string, ttl time.Duration, callback func() (V, error)) (V, error)
Remember berfungsi seperti cache remember di Laravel Mengambil nilai dari cache jika ada dan belum kadaluwarsa. Jika tidak ada atau sudah kadaluwarsa, memanggil fungsi `callback` untuk mendapatkan nilai, menyimpannya di cache, dan mengembalikannya.
Click to show internal directories.
Click to hide internal directories.