Skip to content

Is it possible to optimize the processing efficiency of FastForward? #427

@happyandy2016

Description

@happyandy2016

// fastForward proceeds the current timestamp with duration, works as a time machine
func (db *RedisDB) fastForward(duration time.Duration) {
for _, key := range db.allKeys() {
if value, ok := db.ttl[key]; ok {
db.ttl[key] = value - duration
db.checkTTL(key)
}
}
}
The current function has to traverse all elements. Could we implement a time-sorted queue that only handles expired items to minimize unnecessary traversal?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions