cache

package
v1.0.68 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 3 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL