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

TAKETODAY / today-infrastructure / 20224960533

15 Dec 2025 08:11AM UTC coverage: 84.388% (-0.02%) from 84.404%
20224960533

push

github

TAKETODAY
:white_check_mark: 在测试中排除 jacoco 初始化方法以避免干扰

61869 of 78367 branches covered (78.95%)

Branch coverage included in aggregate %.

145916 of 167860 relevant lines covered (86.93%)

3.71 hits per line

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

66.67
today-context/src/main/java/infra/cache/support/NoOpCacheManager.java
1
/*
2
 * Copyright 2017 - 2025 the original author or authors.
3
 *
4
 * This program is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation, either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program. If not, see [https://www.gnu.org/licenses/]
16
 */
17

18
package infra.cache.support;
19

20
import org.jspecify.annotations.Nullable;
21

22
import java.util.Collection;
23
import java.util.Collections;
24
import java.util.concurrent.ConcurrentHashMap;
25
import java.util.concurrent.ConcurrentMap;
26

27
import infra.cache.Cache;
28
import infra.cache.CacheManager;
29

30
/**
31
 * A basic, no operation {@link CacheManager} implementation suitable
32
 * for disabling caching, typically used for backing cache declarations
33
 * without an actual backing store.
34
 *
35
 * <p>Will simply accept any items into the cache not actually storing them.
36
 *
37
 * @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
38
 * @since 4.0 2022/1/26 14:18
39
 */
40
public class NoOpCacheManager implements CacheManager {
2✔
41

42
  private final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap<>(16);
7✔
43

44
  @Override
45
  public @Nullable Cache getCache(String name) {
46
    return this.cacheMap.computeIfAbsent(name, NoOpCache::new);
7✔
47
  }
48

49
  @Override
50
  public Collection<String> getCacheNames() {
51
    return Collections.unmodifiableSet(this.cacheMap.keySet());
5✔
52
  }
53

54
  @Override
55
  public void resetCaches() {
56
    this.cacheMap.clear();
×
57
  }
×
58

59
}
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