blob: ca91a4d9b3184e5accb7b00a8ae3cf1a146b5dd4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package cache
import (
"git.sr.ht/~rockorager/go-jmap"
"git.sr.ht/~rockorager/go-jmap/mail/thread"
)
func (c *JMAPCache) GetThread(id jmap.ID) (*thread.Thread, error) {
buf, err := c.get(threadKey(id))
if err != nil {
return nil, err
}
e := new(thread.Thread)
err = unmarshal(buf, e)
if err != nil {
return nil, err
}
return e, nil
}
func (c *JMAPCache) PutThread(id jmap.ID, e *thread.Thread) error {
buf, err := marshal(e)
if err != nil {
return err
}
return c.put(threadKey(id), buf)
}
func (c *JMAPCache) DeleteThread(id jmap.ID) error {
return c.delete(threadKey(id))
}
func threadKey(id jmap.ID) string {
return "thread/" + string(id)
}
|