Documentation
¶
Index ¶
- type RedisCacheJsonRepository
- func (r *RedisCacheJsonRepository) CreateIndex(ctx context.Context) error
- func (r *RedisCacheJsonRepository) Delete(ctx context.Context, key string) error
- func (r *RedisCacheJsonRepository) DeleteByPattern(ctx context.Context, pattern string) error
- func (r *RedisCacheJsonRepository) FindAll(ctx context.Context) ([]*domain.CacheEntry, error)
- func (r *RedisCacheJsonRepository) Get(ctx context.Context, key string) (*domain.CacheEntry, error)
- func (r *RedisCacheJsonRepository) SearchByMethod(ctx context.Context, method string) ([]*domain.CacheEntry, error)
- func (r *RedisCacheJsonRepository) SearchByURL(ctx context.Context, urlPattern string) ([]*domain.CacheEntry, error)
- func (r *RedisCacheJsonRepository) SearchExpiring(ctx context.Context, within time.Duration) ([]*domain.CacheEntry, error)
- func (r *RedisCacheJsonRepository) Set(ctx context.Context, key string, value *domain.CacheEntry, ...) error
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 ¶
func (r *RedisCacheJsonRepository) FindAll(ctx context.Context) ([]*domain.CacheEntry, error)
FindAll คืนค่า entries ทั้งหมดที่ยังไม่หมดอายุ
func (*RedisCacheJsonRepository) Get ¶
func (r *RedisCacheJsonRepository) Get(ctx context.Context, key string) (*domain.CacheEntry, error)
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 ที่จะหมดอายุภายในระยะเวลาที่กำหนด