MCPcopy Create free account
hub / github.com/MertJSX/folderhost / Set

Method Set

utils/cache/set.go:5–16  ·  view source on GitHub ↗
(key KeyType, data DataType, duration time.Duration)

Source from the content-addressed store, hash-verified

3import "time"
4
5func (c *Cache[KeyType, DataType]) Set(key KeyType, data DataType, duration time.Duration) {
6 c.Mutex.Lock()
7 defer c.Mutex.Unlock()
8 item := CacheItem[DataType]{
9 LifeTime: time.Now().Add(duration).Unix(),
10 Data: data,
11 }
12 c.Items[key] = item
13 if c.Properties.SetCacheEvent {
14 c.SetCacheEvent <- key
15 }
16}
17
18func (c *Cache[KeyType, DataType]) SetWithoutEventTriggering(key KeyType, data DataType, duration time.Duration) {
19 c.Mutex.Lock()

Callers 12

CheckAuthFunction · 0.80
writeFileFunction · 0.80
GetDownloadLinkFunction · 0.80
VerifyPasswordFunction · 0.80
RawFileFunction · 0.80
DownloadFunction · 0.80
ReadDirectoryFunction · 0.80
TestCache_SetAndGetFunction · 0.80
TestCache_DeleteFunction · 0.80
TestCache_ClearFunction · 0.80
TestCache_ExpirationFunction · 0.80

Calls

no outgoing calls

Tested by 5

TestCache_SetAndGetFunction · 0.64
TestCache_DeleteFunction · 0.64
TestCache_ClearFunction · 0.64
TestCache_ExpirationFunction · 0.64