+5
-5
atproto/identity/cache_directory.go
+5
-5
atproto/identity/cache_directory.go
···
174
}
175
176
func (d *CacheDirectory) LookupDID(ctx context.Context, did syntax.DID) (*Identity, error) {
177
-
id, _, err := d.lookupDIDWithCacheState(ctx, did)
178
return id, err
179
}
180
181
-
func (d *CacheDirectory) lookupDIDWithCacheState(ctx context.Context, did syntax.DID) (*Identity, bool, error) {
182
start := time.Now()
183
entry, ok := d.identityCache.Get(did)
184
if ok && !d.isIdentityStale(&entry) {
···
232
}
233
234
func (d *CacheDirectory) LookupHandle(ctx context.Context, h syntax.Handle) (*Identity, error) {
235
-
ident, _, err := d.lookupHandleWithCacheState(ctx, h)
236
return ident, err
237
}
238
239
-
func (d *CacheDirectory) lookupHandleWithCacheState(ctx context.Context, h syntax.Handle) (*Identity, bool, error) {
240
h = h.Normalize()
241
did, err := d.ResolveHandle(ctx, h)
242
if err != nil {
243
return nil, false, err
244
}
245
-
ident, hit, err := d.lookupDIDWithCacheState(ctx, did)
246
if err != nil {
247
return nil, hit, err
248
}
···
174
}
175
176
func (d *CacheDirectory) LookupDID(ctx context.Context, did syntax.DID) (*Identity, error) {
177
+
id, _, err := d.LookupDIDWithCacheState(ctx, did)
178
return id, err
179
}
180
181
+
func (d *CacheDirectory) LookupDIDWithCacheState(ctx context.Context, did syntax.DID) (*Identity, bool, error) {
182
start := time.Now()
183
entry, ok := d.identityCache.Get(did)
184
if ok && !d.isIdentityStale(&entry) {
···
232
}
233
234
func (d *CacheDirectory) LookupHandle(ctx context.Context, h syntax.Handle) (*Identity, error) {
235
+
ident, _, err := d.LookupHandleWithCacheState(ctx, h)
236
return ident, err
237
}
238
239
+
func (d *CacheDirectory) LookupHandleWithCacheState(ctx context.Context, h syntax.Handle) (*Identity, bool, error) {
240
h = h.Normalize()
241
did, err := d.ResolveHandle(ctx, h)
242
if err != nil {
243
return nil, false, err
244
}
245
+
ident, hit, err := d.LookupDIDWithCacheState(ctx, did)
246
if err != nil {
247
return nil, hit, err
248
}