MCPcopy Create free account
hub / github.com/bricks-cloud/BricksLLM / Set

Method Set

internal/storage/redis/access-cache.go:36–50  ·  view source on GitHub ↗
(key string, timeUnit key.TimeUnit)

Source from the content-addressed store, hash-verified

34}
35
36func (ac *AccessCache) Set(key string, timeUnit key.TimeUnit) error {
37 ttl, err := getCounterTtl(timeUnit)
38 if err != nil {
39 return err
40 }
41
42 ctx, cancel := context.WithTimeout(context.Background(), ac.wt)
43 defer cancel()
44 err = ac.client.Set(ctx, key, true, ttl.Sub(time.Now())).Err()
45 if err != nil {
46 return err
47 }
48
49 return nil
50}
51
52func (ac *AccessCache) GetAccessStatus(key string) bool {
53 ctx, cancel := context.WithTimeout(context.Background(), ac.rt)

Callers

nothing calls this directly

Calls 2

getCounterTtlFunction · 0.85
SetMethod · 0.65

Tested by

no test coverage detected