Documentation
¶
Index ¶
- Constants
- Variables
- func GetClient(config config.Config, connection string) (redis.UniversalClient, error)
- type Cache
- func (r *Cache) Add(key string, value any, t time.Duration) bool
- func (r *Cache) Decrement(key string, value ...int64) (int64, error)
- func (r *Cache) Docker() (contractsdocker.CacheDriver, error)
- func (r *Cache) Flush() bool
- func (r *Cache) Forever(key string, value any) bool
- func (r *Cache) Forget(key string) bool
- func (r *Cache) Get(key string, def ...any) any
- func (r *Cache) GetBool(key string, def ...bool) bool
- func (r *Cache) GetInt(key string, def ...int) int
- func (r *Cache) GetInt64(key string, def ...int64) int64
- func (r *Cache) GetString(key string, def ...string) string
- func (r *Cache) Has(key string) bool
- func (r *Cache) Increment(key string, value ...int64) (int64, error)
- func (r *Cache) Lock(key string, t ...time.Duration) contractscache.Lock
- func (r *Cache) Pull(key string, def ...any) any
- func (r *Cache) Put(key string, value any, t time.Duration) error
- func (r *Cache) Remember(key string, seconds time.Duration, callback func() (any, error)) (any, error)
- func (r *Cache) RememberForever(key string, callback func() (any, error)) (any, error)
- func (r *Cache) WithContext(ctx context.Context) contractscache.Driver
- type Docker
- type Job
- type JobRecord
- type Queue
- type QueueKey
- type ReservedJob
- type ServiceProvider
- type Session
- type Task
Constants ¶
View Source
const ( BindingCache = "goravel.redis.cache" BindingQueue = "goravel.redis.queue" BindingSession = "goravel.redis.session" Name = "redis" )
Variables ¶
View Source
var ( ErrRedisServiceProviderNotRegistered = errors.New("please register redis service provider").SetModule("Redis") ErrRedisStoreIsRequired = errors.New("store is required").SetModule("Redis") ErrRedisConnectionIsRequired = errors.New("connection is required").SetModule("Redis") ErrSessionDriverIsRequired = errors.New("session driver is required").SetModule("Redis") )
View Source
var App foundation.Application
Functions ¶
func GetClient ¶ added in v1.17.0
GetClient returns a Redis client for the specified connection name. It uses a cached instance if one already exists for the name, otherwise, it creates, caches, and returns a new one. It is thread-safe. Returns an error if the client cannot be created or configured correctly.
Types ¶
type Cache ¶ added in v1.4.0
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) Docker ¶ added in v1.4.0
func (r *Cache) Docker() (contractsdocker.CacheDriver, error)
func (*Cache) Remember ¶ added in v1.4.0
func (r *Cache) Remember(key string, seconds time.Duration, callback func() (any, error)) (any, error)
Remember Get an item from the cache, or execute the given Closure and store the result.
func (*Cache) RememberForever ¶ added in v1.4.0
RememberForever Get an item from the cache, or execute the given Closure and store the result forever.
func (*Cache) WithContext ¶ added in v1.4.0
func (r *Cache) WithContext(ctx context.Context) contractscache.Driver
type Docker ¶ added in v1.4.0
type Docker struct {
// contains filtered or unexported fields
}
func NewDocker ¶ added in v1.4.0
func NewDocker(config contractsconfig.Config, process contractsprocess.Process, store string) (*Docker, error)
func (*Docker) Config ¶ added in v1.4.0
func (r *Docker) Config() contractsdocker.CacheConfig
func (*Docker) Image ¶ added in v1.4.0
func (r *Docker) Image(image contractsdocker.Image)
type Job ¶ added in v1.4.0
type Job struct {
Signature string `json:"signature"`
Args []contractsqueue.Arg `json:"args"`
Delay *time.Time `json:"delay"`
}
type JobRecord ¶ added in v1.4.0
type Queue ¶ added in v1.4.0
type Queue struct {
// contains filtered or unexported fields
}
func (*Queue) Pop ¶ added in v1.4.0
func (r *Queue) Pop(queue string) (contractsqueue.ReservedJob, error)
type QueueKey ¶ added in v1.4.0
type QueueKey struct {
// contains filtered or unexported fields
}
func NewQueueKey ¶ added in v1.4.0
type ReservedJob ¶ added in v1.4.0
type ReservedJob struct {
// contains filtered or unexported fields
}
func NewReservedJob ¶ added in v1.4.0
func NewReservedJob(ctx context.Context, client redis.UniversalClient, jobRecord JobRecord, jobStorer contractsqueue.JobStorer, json contractsfoundation.Json, reservedQueueKey string) (*ReservedJob, error)
func (*ReservedJob) Delete ¶ added in v1.4.0
func (r *ReservedJob) Delete() error
func (*ReservedJob) Task ¶ added in v1.4.0
func (r *ReservedJob) Task() contractsqueue.Task
type ServiceProvider ¶
type ServiceProvider struct {
}
func (*ServiceProvider) Boot ¶
func (r *ServiceProvider) Boot(app foundation.Application)
func (*ServiceProvider) Register ¶
func (r *ServiceProvider) Register(app foundation.Application)
func (*ServiceProvider) Relationship ¶ added in v1.4.0
func (r *ServiceProvider) Relationship() binding.Relationship
type Session ¶ added in v1.4.0
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶ added in v1.4.0
NewSession creates a new Redis session driver using Goravel's configuration.
func (*Session) Gc ¶ added in v1.4.0
Gc performs garbage collection. (No-op for Redis TTL-based expiration)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.