Better tracing
Not done yet, still need to add them to just about every other function
This commit is contained in:
parent
83f47d17be
commit
529d106351
13 changed files with 148 additions and 22 deletions
4
storage/cache/cache.go
vendored
4
storage/cache/cache.go
vendored
|
@ -13,6 +13,7 @@ import (
|
|||
"github.com/redis/go-redis/v9"
|
||||
"github.com/rs/zerolog/log"
|
||||
"gitlab.com/mstarongitlab/linstrom/config"
|
||||
"gitlab.com/mstarongitlab/linstrom/util"
|
||||
)
|
||||
|
||||
type Cache struct {
|
||||
|
@ -72,6 +73,7 @@ func NewCache(maxSize int64, redisUrl *string) (*Cache, error) {
|
|||
}
|
||||
|
||||
func (c *Cache) Get(key string, target any) (bool, error) {
|
||||
defer util.Untrace(util.Trace(&log.Logger))
|
||||
return false, nil
|
||||
data, err := c.cache.Get(ctxBackground, key)
|
||||
if err != nil {
|
||||
|
@ -85,6 +87,7 @@ func (c *Cache) Get(key string, target any) (bool, error) {
|
|||
}
|
||||
|
||||
func (c *Cache) Set(key string, value any) error {
|
||||
defer util.Untrace(util.Trace(&log.Logger))
|
||||
return nil
|
||||
data, err := c.encoders.Encode(value)
|
||||
if err != nil {
|
||||
|
@ -95,6 +98,7 @@ func (c *Cache) Set(key string, value any) error {
|
|||
}
|
||||
|
||||
func (c *Cache) Delete(key string) {
|
||||
defer util.Untrace(util.Trace(&log.Logger))
|
||||
// Error return doesn't matter here. Delete is delete is gone
|
||||
_ = c.cache.Delete(ctxBackground, key)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue