Monorepo for Tangled
tangled.org
1package cursor
2
3import (
4 "sync"
5)
6
7type MemoryStore struct {
8 store sync.Map
9}
10
11func (m *MemoryStore) Set(key string, cursor int64) {
12 m.store.Store(key, cursor)
13}
14
15func (m *MemoryStore) Get(key string) (cursor int64) {
16 if result, ok := m.store.Load(key); ok {
17 if val, ok := result.(int64); ok {
18 return val
19 }
20 }
21 return 0
22}