+4
api/plc.go
+4
api/plc.go
+2
bgs/bgs.go
+2
bgs/bgs.go
···
785
785
786
786
return nil
787
787
case env.RepoHandle != nil:
788
+
// Flush any cached DID documents for this user
789
+
bgs.didr.FlushCacheFor(env.RepoHandle.Did)
788
790
789
791
// TODO: ignoring the data in the message and just going out to the DID doc
790
792
act, err := bgs.createExternalUser(ctx, env.RepoHandle.Did)
+17
did/multi.go
+17
did/multi.go
···
9
9
10
10
type Resolver interface {
11
11
GetDocument(ctx context.Context, didstr string) (*did.Document, error)
12
+
FlushCacheFor(did string)
12
13
}
13
14
14
15
type MultiResolver struct {
···
23
24
24
25
func (mr *MultiResolver) AddHandler(method string, res Resolver) {
25
26
mr.handlers[method] = res
27
+
}
28
+
29
+
func (mr *MultiResolver) FlushCacheFor(didstr string) {
30
+
pdid, err := did.ParseDID(didstr)
31
+
if err != nil {
32
+
return
33
+
}
34
+
35
+
method := pdid.Protocol()
36
+
37
+
res, ok := mr.handlers[method]
38
+
if !ok {
39
+
return
40
+
}
41
+
42
+
res.FlushCacheFor(didstr)
26
43
}
27
44
28
45
func (mr *MultiResolver) GetDocument(ctx context.Context, didstr string) (*did.Document, error) {
+4
did/web.go
+4
did/web.go
+5
-1
plc/caching.go
+5
-1
plc/caching.go
···
4
4
"context"
5
5
"time"
6
6
7
-
did "github.com/bluesky-social/indigo/did"
7
+
"github.com/bluesky-social/indigo/did"
8
8
lru "github.com/hashicorp/golang-lru"
9
9
"go.opentelemetry.io/otel"
10
10
"go.opentelemetry.io/otel/attribute"
···
32
32
cache: c,
33
33
maxAge: maxAge,
34
34
}
35
+
}
36
+
37
+
func (r *CachingDidResolver) FlushCacheFor(didstr string) {
38
+
r.cache.Remove(didstr)
35
39
}
36
40
37
41
func (r *CachingDidResolver) tryCache(did string) (*did.Document, bool) {
+4
plc/fakedid.go
+4
plc/fakedid.go