gfc-cache


License

License

GroupId

GroupId

org.gfccollective
ArtifactId

ArtifactId

gfc-cache_2.12
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

gfc-cache
gfc-cache
Project URL

Project URL

https://github.com/gfc-collective/gfc-cache
Project Organization

Project Organization

org.gfccollective
Source Code Management

Source Code Management

https://github.com/gfc-collective/gfc-cache.git

Download gfc-cache_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/org.gfccollective/gfc-cache_2.12/ -->
<dependency>
    <groupId>org.gfccollective</groupId>
    <artifactId>gfc-cache_2.12</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.gfccollective/gfc-cache_2.12/
implementation 'org.gfccollective:gfc-cache_2.12:1.0.0'
// https://jarcasting.com/artifacts/org.gfccollective/gfc-cache_2.12/
implementation ("org.gfccollective:gfc-cache_2.12:1.0.0")
'org.gfccollective:gfc-cache_2.12:jar:1.0.0'
<dependency org="org.gfccollective" name="gfc-cache_2.12" rev="1.0.0">
  <artifact name="gfc-cache_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.gfccollective', module='gfc-cache_2.12', version='1.0.0')
)
libraryDependencies += "org.gfccollective" % "gfc-cache_2.12" % "1.0.0"
[org.gfccollective/gfc-cache_2.12 "1.0.0"]

Dependencies

compile (6)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.10
org.gfccollective : gfc-time_2.12 jar 1.0.0
org.gfccollective : gfc-concurrent_2.12 jar 1.0.0
org.gfccollective : gfc-logging_2.12 jar 1.0.0
org.gfccollective : gfc-util_2.12 jar 1.0.0
org.gfccollective : gfc-guava_2.12 jar 1.0.0

test (3)

Group / Artifact Type Version
org.scalatest : scalatest_2.12 jar 3.1.0
org.scalatestplus : mockito-3-2_2.12 jar 3.1.0.0
org.mockito : mockito-core jar 3.2.4

Project Modules

There are no modules declared in this project.

gfc-cache Maven Central Build Status Coverage Status

A library that contains scala caching helper code. A fork and new home of the now unmaintained Gilt Foundation Classes (com.gilt.gfc), now called the GFC Collective, maintained by some of the original authors.

Getting gfc-cache

The latest version is 1.0.0, released on 21/Jan/2020 and cross-built against Scala 2.12.x and 2.13.x.

If you're using SBT, add the following line to your build file:

libraryDependencies += "org.gfccollective" %% "gfc-cache" % "1.0.0"

For Maven and other build tools, you can visit search.maven.org. (This search will also list other available libraries from the GFC Collective.)

Contents and Example Usage

org.gfccollective.cache.AsyncCache & AsyncCacheImpl

AsyncCache represents an asynchronous cache. It may not contain the whole data, and will return Future[Option[V]] to show that the value may be lazy-loaded by issuing a remote call.

AsyncCacheImpl is an implementation of AsyncCache that adds build-load functionality, which requires a load function to be implemented, which is called on cache-miss.

org.gfccollective.cache.SyncCache & SyncCacheImpl

SyncCache represents an in-memory cache, returning values as Option[V] indicating that no values are lazy-loaded on cache-miss.

SyncCacheImpl is an implementation of SyncCache that adds build-load functionality, which requires a load function to be implemented, which is called on cache-miss.

org.gfccollective.cache.CacheConfiguration

Mix in this trait to provide configuration for the cache. The following parameters are needed:

  • refreshPeriodMs: how often to reload the cache, in millis.
  • cacheInitStrategy: how to initialize the cache, either synchronously or asynchronously.

Code coverage report

$ sbt clean coverage test coverageReport

License

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

org.gfccollective

The GFC Collective

The new home of the (former) Gilt Foundation Classes

Versions

Version
1.0.0