MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / TestExpireStructure_PERSIST

Function TestExpireStructure_PERSIST

structure/expiring_key_test.go:140–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

138}
139
140func TestExpireStructure_PERSIST(t *testing.T) {
141 expire, _ := initExpire()
142 defer expire.db.Close()
143
144 key := "test_key"
145 seconds := int64(2)
146
147 // Set an expiration time for the key
148 expire.EXPIRE(key, seconds)
149
150 // Test PERSIST function
151 expireErr = expire.PERSIST(key, seconds)
152 assert.Nil(t, expireErr)
153
154 // Check if the key is still in the database and has no expiration time
155 ttl, err := expire.TTL(key)
156 assert.Nil(t, err)
157 assert.Equal(t, int64(-1), ttl) // -1 indicates that the key has no expiration
158}
159
160func TestExpireStructure_EXPIREBY(t *testing.T) {
161 expire, _ := initExpire()

Callers

nothing calls this directly

Calls 5

initExpireFunction · 0.85
EXPIREMethod · 0.80
PERSISTMethod · 0.80
CloseMethod · 0.65
TTLMethod · 0.65

Tested by

no test coverage detected