Expiring Map

Small library to provide in-memory storage which expires entries if unused for a period of time.

License

License

GroupId

GroupId

io.github.galbiston
ArtifactId

ArtifactId

expiring-map
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

Expiring Map
Small library to provide in-memory storage which expires entries if unused for a period of time.
Project URL

Project URL

https://github.com/galbiston/expiring-map
Source Code Management

Source Code Management

https://github.com/galbiston/expiring-map.git

Download expiring-map

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.galbiston/expiring-map/ -->
<dependency>
    <groupId>io.github.galbiston</groupId>
    <artifactId>expiring-map</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.galbiston/expiring-map/
implementation 'io.github.galbiston:expiring-map:1.0.2'
// https://jarcasting.com/artifacts/io.github.galbiston/expiring-map/
implementation ("io.github.galbiston:expiring-map:1.0.2")
'io.github.galbiston:expiring-map:jar:1.0.2'
<dependency org="io.github.galbiston" name="expiring-map" rev="1.0.2">
  <artifact name="expiring-map" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.galbiston', module='expiring-map', version='1.0.2')
)
libraryDependencies += "io.github.galbiston" % "expiring-map" % "1.0.2"
[io.github.galbiston/expiring-map "1.0.2"]

Dependencies

runtime (1)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.25

Project Modules

There are no modules declared in this project.

Expiring Map

Small library to provide in-memory storage which expires entries if unused for a period of time. Size of map, duration until expiry and frequency of cleaning can all be controlled.

Getting Started

Expiring Map can be accessed as a library using Maven etc. from Maven Central.

<dependency>
    <groupId>io.github.galbiston</groupId>
    <artifactId>expiring-map</artifactId>
    <version>1.0.1</version>
</dependency>
  • Constructor: ExpiringMap<String, String> expiringMap = new ExpiringMap<>("MyMap", 10000, 2000);

  • Start Expiry: expiringMap.startExpiry();

  • Stop Expiry: expiringMap.stopExpiry();

  • Put: expiringMap.put("KeyA", "ValueA");

  • Get: String value = expiringMap.get("KeyA");

  • Contains Key: boolean isContained = expiringMap.containsKey("KeyA");

  • Delay between warnings the map is full: expiringMap.setFullMapWarningInterval(10000);

Versions

Version
1.0.2
1.0.1
1.0.0