Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-12-11 18:07:13 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-12-11 18:07:13 +0300
commit3ae2f4c7bb3e28f213ee54d33dbf6fd370277996 (patch)
tree9637768b5f96f210812669fea5cf10d84e3958ae /internal/source/gitlab/cache/cache.go
parent860072e9807e8ab8ce6b213f4f72f42d91c1ad70 (diff)
Add caching on top of gitlab domains source client
Diffstat (limited to 'internal/source/gitlab/cache/cache.go')
-rw-r--r--internal/source/gitlab/cache/cache.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/internal/source/gitlab/cache/cache.go b/internal/source/gitlab/cache/cache.go
index 85f44e11..7bf755a3 100644
--- a/internal/source/gitlab/cache/cache.go
+++ b/internal/source/gitlab/cache/cache.go
@@ -20,7 +20,7 @@ func NewCache(client api.Client) *Cache {
}
}
-// Resolve is going to return a Lookup based on a domain name. The caching
+// GetLookup is going to return a lookup based on a domain name. The caching
// algorithm works as follows:
// - We first check if the cache entry exists, and if it is up-to-date. If it
// is fresh we return the lookup entry from cache and it is a cache hit.
@@ -69,7 +69,7 @@ func NewCache(client api.Client) *Cache {
// - we create a lookup that contains information about an error
// - we cache this response
// - we pass this lookup upstream to all the clients
-func (c *Cache) Resolve(ctx context.Context, domain string) *api.Lookup {
+func (c *Cache) GetLookup(ctx context.Context, domain string) *api.Lookup {
entry := c.store.LoadOrCreate(domain)
if entry.IsUpToDate() {
@@ -84,8 +84,3 @@ func (c *Cache) Resolve(ctx context.Context, domain string) *api.Lookup {
return entry.Retrieve(ctx, c.client)
}
-
-// New creates a new instance of Cache and sets default expiration
-func New() *Cache {
- return &Cache{}
-}