• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FIWARE / VCVerifier / 9497802989

13 Jun 2024 10:12AM UTC coverage: 50.855% (-0.2%) from 51.047%
9497802989

Pull #38

github

wistefan
doc and cleanup
Pull Request #38: deny if the credential type is not included

13 of 44 new or added lines in 5 files covered. (29.55%)

1 existing line in 1 file now uncovered.

981 of 1929 relevant lines covered (50.86%)

0.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

25.0
/openapi/caching_client.go
1
package openapi
2

3
import (
4
        "time"
5

6
        "github.com/fiware/VCVerifier/common"
7
        "github.com/fiware/VCVerifier/logging"
8
        "github.com/patrickmn/go-cache"
9
        "github.com/piprate/json-gold/ld"
10
)
11

12
type CachingDocumentLoader struct {
13
        defaultLoader ld.DocumentLoader
14
        contextCache  common.Cache
15
}
16

17
func NewCachingDocumentLoader(defaultLoader ld.DocumentLoader) ld.DocumentLoader {
1✔
18
        return CachingDocumentLoader{defaultLoader: defaultLoader,
1✔
19
                contextCache: cache.New(time.Duration(300)*time.Second, time.Duration(600)*time.Second)}
1✔
20
}
1✔
21

NEW
22
func (cdl CachingDocumentLoader) LoadDocument(u string) (document *ld.RemoteDocument, err error) {
×
NEW
23
        cachedDocument, hit := cdl.contextCache.Get(u)
×
NEW
24
        if hit {
×
NEW
25
                return cachedDocument.(*ld.RemoteDocument), err
×
NEW
26
        }
×
NEW
27
        document, err = cdl.defaultLoader.LoadDocument(u)
×
NEW
28
        if err != nil {
×
NEW
29
                logging.Log().Infof("Was not able to load %s", u)
×
NEW
30
                return document, err
×
NEW
31
        }
×
NEW
32
        cdl.contextCache.Set(u, document, cache.DefaultExpiration)
×
NEW
33
        return document, err
×
34
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc