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

Function NewExpireStructure

structure/expiring_key.go:20–26  ·  view source on GitHub ↗

NewExpireStructure returns a new ExpireStructure It will return a nil ExpireStructure if the database cannot be opened or the database cannot be created The database will be created if it does not exist

(options config.Options)

Source from the content-addressed store, hash-verified

18// or the database cannot be created
19// The database will be created if it does not exist
20func NewExpireStructure(options config.Options) (*ExpireStructure, error) {
21 db, err := engine.NewDB(options)
22 if err != nil {
23 return nil, err
24 }
25 return &ExpireStructure{db: db}, nil
26}
27
28func (ek *ExpireStructure) EXPIRE(key string, seconds int64) error {
29 deadtime := ek.getCurrentMiliUnixTimeStamp() + seconds*1000

Callers 1

initExpireFunction · 0.85

Calls 1

NewDBFunction · 0.92

Tested by 1

initExpireFunction · 0.68