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

SAP / feature-toggle-node / 891991c4-7a14-4989-ac56-e39cc2abe6fb

10 Mar 2025 12:40PM UTC coverage: 100.0%. Remained the same
891991c4-7a14-4989-ac56-e39cc2abe6fb

Pull #244

circleci

i053322
docs:  update chanelog 2.0.3
Pull Request #244: docs: update chanelog 2.0.3

53 of 53 branches covered (100.0%)

Branch coverage included in aggregate %.

106 of 106 relevant lines covered (100.0%)

3.71 hits per line

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

100.0
/src/cache.ts
1
import * as NodeCache from "node-cache";
1✔
2
import { Features } from "./client";
3

4
const FEATURES_KEY = "features";
1✔
5
const ftCache = new NodeCache();
1✔
6

7
/*
8
 * Example of cache structure:
9
 *   [features]: { features: [] }     - keep last response with all toggles
10
 *   [toggleName]: boolean            - value of toggles by name that has been called in last ${REFRESH_INTERVAL} minutes
11
 * */
12

13
export function getFeatureToggles(): Features | undefined {
1✔
14
  return ftCache.get(FEATURES_KEY);
3✔
15
}
16

17
export function setFeatureToggles(toggles: Features | undefined): void {
1✔
18
  ftCache.set(FEATURES_KEY, toggles);
3✔
19
}
20

21
export function getToggleByKey(key: string): boolean | undefined {
1✔
22
  return ftCache.get(key);
5✔
23
}
24

25
export function setTogglesByKey(key: string, value: boolean): void {
1✔
26
  ftCache.set(key, value);
3✔
27
}
28

29
export function flushCache(): void {
1✔
30
  ftCache.flushAll();
8✔
31
}
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

© 2025 Coveralls, Inc