This commit is contained in:
2026-04-13 08:10:14 +03:00
commit a4455b1170
18 changed files with 1063 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
package cache
import "log/slog"
// Cache — интерфейс подключения к кэшу.
type Cache interface {
Get(key string) (string, error)
Set(key, value string) error
Close() error
}
// redisCache — конкретная реализация, скрыта от внешних пакетов.
type redisCache struct {
addr string
}
// New создаёт подключение к кэшу.
func New(addr string) Cache {
slog.Info("подключились к кэшу", "addr", addr)
return &redisCache{addr: addr}
}
// Get получает значение по ключу.
func (c *redisCache) Get(key string) (string, error) {
return "", nil
}
// Set устанавливает значение по ключу.
func (c *redisCache) Set(key, value string) error {
return nil
}
// Close закрывает подключение к кэшу.
func (c *redisCache) Close() error {
slog.Info("подключение к кэшу закрыто")
return nil
}