feat: implement geometry, battle replay, and entity repositories with caching support
All checks were successful
Build and Release / release (push) Successful in 1m31s
All checks were successful
Build and Release / release (push) Successful in 1m31s
This commit is contained in:
@@ -166,9 +166,7 @@ func (r *battleReplayRepository) GetByGeometryID(ctx context.Context, geometryID
|
|||||||
if len(itemToCache) > 0 {
|
if len(itemToCache) > 0 {
|
||||||
_ = r.c.MSet(ctx, itemToCache, constants.NormalCacheDuration)
|
_ = r.c.MSet(ctx, itemToCache, constants.NormalCacheDuration)
|
||||||
}
|
}
|
||||||
if len(ids) > 0 {
|
_ = r.c.Set(ctx, cacheKey, ids, constants.ListCacheDuration)
|
||||||
_ = r.c.Set(ctx, cacheKey, ids, constants.ListCacheDuration)
|
|
||||||
}
|
|
||||||
|
|
||||||
return items, nil
|
return items, nil
|
||||||
}
|
}
|
||||||
@@ -233,9 +231,7 @@ func (r *battleReplayRepository) GetByProjectID(ctx context.Context, projectID p
|
|||||||
if len(itemToCache) > 0 {
|
if len(itemToCache) > 0 {
|
||||||
_ = r.c.MSet(ctx, itemToCache, constants.NormalCacheDuration)
|
_ = r.c.MSet(ctx, itemToCache, constants.NormalCacheDuration)
|
||||||
}
|
}
|
||||||
if len(ids) > 0 {
|
_ = r.c.Set(ctx, cacheKey, ids, constants.ListCacheDuration)
|
||||||
_ = r.c.Set(ctx, cacheKey, ids, constants.ListCacheDuration)
|
|
||||||
}
|
|
||||||
|
|
||||||
return items, nil
|
return items, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -297,9 +297,7 @@ func (r *entityRepository) GetByProjectID(ctx context.Context, projectID pgtype.
|
|||||||
if len(entityToCache) > 0 {
|
if len(entityToCache) > 0 {
|
||||||
_ = r.c.MSet(ctx, entityToCache, constants.NormalCacheDuration)
|
_ = r.c.MSet(ctx, entityToCache, constants.NormalCacheDuration)
|
||||||
}
|
}
|
||||||
if len(ids) > 0 {
|
_ = r.c.Set(ctx, cacheKey, ids, constants.ListCacheDuration)
|
||||||
_ = r.c.Set(ctx, cacheKey, ids, constants.ListCacheDuration)
|
|
||||||
}
|
|
||||||
|
|
||||||
return entities, nil
|
return entities, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,9 +351,7 @@ func (r *geometryRepository) GetByProjectID(ctx context.Context, projectID pgtyp
|
|||||||
if len(geometryToCache) > 0 {
|
if len(geometryToCache) > 0 {
|
||||||
_ = r.c.MSet(ctx, geometryToCache, constants.NormalCacheDuration)
|
_ = r.c.MSet(ctx, geometryToCache, constants.NormalCacheDuration)
|
||||||
}
|
}
|
||||||
if len(ids) > 0 {
|
_ = r.c.Set(ctx, cacheKey, ids, constants.ListCacheDuration)
|
||||||
_ = r.c.Set(ctx, cacheKey, ids, constants.ListCacheDuration)
|
|
||||||
}
|
|
||||||
|
|
||||||
return geometries, nil
|
return geometries, nil
|
||||||
}
|
}
|
||||||
@@ -401,10 +399,7 @@ func (r *geometryRepository) GetGeometriesByBoundWith(ctx context.Context, bound
|
|||||||
if len(geometryToCache) > 0 {
|
if len(geometryToCache) > 0 {
|
||||||
_ = r.c.MSet(ctx, geometryToCache, constants.NormalCacheDuration)
|
_ = r.c.MSet(ctx, geometryToCache, constants.NormalCacheDuration)
|
||||||
}
|
}
|
||||||
if len(ids) > 0 {
|
_ = r.c.Set(ctx, cacheKey, ids, constants.ListCacheDuration)
|
||||||
_ = r.c.Set(ctx, cacheKey, ids, constants.ListCacheDuration)
|
|
||||||
}
|
|
||||||
|
|
||||||
return geometries, nil
|
return geometries, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user