You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The caching package provides utilities for creating caching decorators to enhance the performance of functions by storing computed results. It includes both thread-safe and non-thread-safe implementations.
4
+
5
+
-**SafeCacheWrapper**: A thread-safe caching decorator that safely memoizes function results in concurrent environments.
6
+
7
+
- Uses `sync.Map` to ensure thread-safety
8
+
- Caches all results indefinitely (no eviction)
9
+
- Best suited for pure functions with limited input domains
10
+
- Safe for concurrent access but may impact performance under high contention
11
+
12
+
-**CacheWrapper**: A non-thread-safe caching decorator that memoizes function results.
13
+
- Caches all results indefinitely (no eviction)
14
+
- Best suited for pure functions with limited input domains
15
+
- Not safe for concurrent access
16
+
- Use SafeCacheWrapper for concurrent scenarios
17
+
18
+
## Examples:
19
+
20
+
For examples of each function, please checkout [EXAMPLES.md](/caching/EXAMPLES.md)
Copy file name to clipboardExpand all lines: fsutils/README.md
-19Lines changed: 0 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,25 +12,6 @@
12
12
13
13
-**GetFileMetadata**: Retrieves metadata for a specified file path. Returns a `FileMetadata` struct that can be marshaled to JSON.
14
14
15
-
### 17. Caching
16
-
17
-
The caching package provides utilities for creating caching decorators to enhance the performance of functions by storing computed results. It includes both thread-safe and non-thread-safe implementations.
18
-
19
-
-**SafeCacheWrapper**: A thread-safe caching decorator that safely memoizes function results in concurrent environments.
20
-
21
-
- Uses `sync.Map` to ensure thread-safety
22
-
- Caches all results indefinitely (no eviction)
23
-
- Best suited for pure functions with limited input domains
24
-
- Safe for concurrent access but may impact performance under high contention
25
-
26
-
-**CacheWrapper**: A non-thread-safe caching decorator that memoizes function results.
27
-
- Caches all results indefinitely (no eviction)
28
-
- Best suited for pure functions with limited input domains
29
-
- Not safe for concurrent access
30
-
- Use SafeCacheWrapper for concurrent scenarios
31
-
32
-
---
33
-
34
15
## Examples:
35
16
36
17
For examples of each function, please checkout [EXAMPLES.md](/fsutils/EXAMPLES.md)
0 commit comments