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

Waffle / waffle / 6516

11 Mar 2026 12:15AM UTC coverage: 46.217%. Remained the same
6516

push

github

web-flow
Update dependency org.eclipse.jdt:ecj to v3.45.0

276 of 734 branches covered (37.6%)

Branch coverage included in aggregate %.

1019 of 2068 relevant lines covered (49.27%)

1.0 hits per line

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

33.33
/Source/JNA/waffle-jna/src/main/java/waffle/util/cache/CaffeineCache.java
1
/*
2
 * SPDX-License-Identifier: MIT
3
 * See LICENSE file for details.
4
 *
5
 * Copyright 2010-2026 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors
6
 */
7
package waffle.util.cache;
8

9
import com.github.benmanes.caffeine.cache.Caffeine;
10

11
import java.time.Duration;
12

13
import org.checkerframework.checker.index.qual.NonNegative;
14

15
/**
16
 * A {@link Cache} based on {@link com.github.benmanes.caffeine.cache.Cache}.
17
 *
18
 * @param <K>
19
 *            the type of keys maintained by this cache
20
 * @param <V>
21
 *            the type of mapped values
22
 */
23
public class CaffeineCache<K, V> implements Cache<K, V> {
24

25
    /** The cache store. */
26
    private final com.github.benmanes.caffeine.cache.Cache<K, V> cache;
27

28
    /**
29
     * Instantiate new caffeine cache with timeout.
30
     *
31
     * @param timeout
32
     *            Specified timeout in seconds for cache.
33
     */
34
    public CaffeineCache(@NonNegative final long timeout) {
2✔
35
        cache = Caffeine.newBuilder().expireAfterWrite(Duration.ofSeconds(timeout)).build();
2✔
36
    }
2✔
37

38
    @Override
39
    public V get(final K key) {
40
        return cache.asMap().get(key);
×
41
    }
42

43
    @Override
44
    public void put(final K key, final V value) {
45
        cache.put(key, value);
×
46
    }
×
47

48
    @Override
49
    public void remove(final K key) {
50
        cache.asMap().remove(key);
×
51
    }
×
52

53
    @Override
54
    public int size() {
55
        return cache.asMap().size();
×
56
    }
57
}
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