jsonredis

package
v0.0.0-...-8b2a8cd Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisCacheJsonRepository

type RedisCacheJsonRepository struct {
	// contains filtered or unexported fields
}

RedisCacheJsonRepository เป็น implementation ของ CacheRepository ที่ใช้ Redis JSON module ในการเก็บข้อมูล ทำให้สามารถค้นหาได้ด้วย RedisSearch

func NewRedisCacheJsonRepository

func NewRedisCacheJsonRepository(client *redis.Client, prefix string, log *zap.SugaredLogger) *RedisCacheJsonRepository

NewRedisCacheJsonRepository สร้าง instance ใหม่ของ RedisCacheJsonRepository

func (*RedisCacheJsonRepository) CreateIndex

func (r *RedisCacheJsonRepository) CreateIndex(ctx context.Context) error

CreateIndex สร้าง index สำหรับการค้นหาใน Redis โดยใช้ RedisSearch module

func (*RedisCacheJsonRepository) Delete

func (r *RedisCacheJsonRepository) Delete(ctx context.Context, key string) error

Delete ลบข้อมูล cache ตาม key ที่กำหนด

func (*RedisCacheJsonRepository) DeleteByPattern

func (r *RedisCacheJsonRepository) DeleteByPattern(ctx context.Context, pattern string) error

DeleteByPattern ลบข้อมูล cache ที่ key ตรงกับ pattern ที่กำหนด

func (*RedisCacheJsonRepository) FindAll

FindAll คืนค่า entries ทั้งหมดที่ยังไม่หมดอายุ

func (*RedisCacheJsonRepository) Get

Get ดึงข้อมูล cache จาก key ที่กำหนด

func (*RedisCacheJsonRepository) SearchByMethod

func (r *RedisCacheJsonRepository) SearchByMethod(ctx context.Context, method string) ([]*domain.CacheEntry, error)

SearchByMethod ค้นหา entries ที่มี Method ตรงกับที่กำหนด

func (*RedisCacheJsonRepository) SearchByURL

func (r *RedisCacheJsonRepository) SearchByURL(ctx context.Context, urlPattern string) ([]*domain.CacheEntry, error)

SearchByURL ค้นหา entries ที่มี URL ตรงกับ pattern ที่กำหนด

func (*RedisCacheJsonRepository) SearchExpiring

func (r *RedisCacheJsonRepository) SearchExpiring(ctx context.Context, within time.Duration) ([]*domain.CacheEntry, error)

SearchExpiring ค้นหา entries ที่จะหมดอายุภายในระยะเวลาที่กำหนด

func (*RedisCacheJsonRepository) Set

func (r *RedisCacheJsonRepository) Set(ctx context.Context, key string, value *domain.CacheEntry, expiration time.Duration) error

Set เก็บข้อมูล cache ด้วย key ที่กำหนดและกำหนดเวลาหมดอายุ

Jump to

Keyboard shortcuts

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