support periodically cleaning up expired tokens

This commit is contained in:
MaysWind
2024-08-12 00:49:07 +08:00
parent 80b8b9afdd
commit 52dfee9ca6
22 changed files with 506 additions and 7 deletions
+10
View File
@@ -12,6 +12,16 @@ type DataStore struct {
databases []*Database
}
// Count returns total count of database instances
func (s *DataStore) Count() int {
return len(s.databases)
}
// Get returns a database instance by index
func (s *DataStore) Get(index int) *Database {
return s.databases[index]
}
// Choose returns a database instance by sharding key
func (s *DataStore) Choose(key int64) *Database {
return s.databases[0]