Skip to content

Commit

Permalink
docs: README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
QwQ-dev committed Dec 23, 2024
1 parent 14e6be3 commit a0ce642
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The original purpose of this module was to design a L1 cache for the `mongodb` m
```kotlin
// Dependencies
dependencies {
// annotation module
// cache module
compileOnly("me.qwqdev.library:cache:1.0-SNAPSHOT")
}
```
Expand Down Expand Up @@ -58,6 +58,18 @@ public class CacheLauncher {
true
);

// for redisCacheService, it is recommended to use redissonClient to acquire the lock
redisCache.execute(
// get lock
redissonClient -> redissonClient.getLock("a"),

// do something
redissonClient -> redissonClient.getBucket("a").get(),

// lock settings
LockSettings.of(1, 1, TimeUnit.MINUTES)
);


/*
* Caffeine cache example
Expand Down Expand Up @@ -107,7 +119,7 @@ public class CacheLauncher {
LockSettings.of(1, 1, TimeUnit.MINUTES)
);

// thread-safe execution of something, redis cache same
// thread-safe execution of something
caffeineCache.execute(
// get lock
cache -> new ReentrantLock(),
Expand Down
2 changes: 1 addition & 1 deletion mongodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For the first and second level cache, it is actually implemented in the cache mo
```kotlin
// Dependencies
dependencies {
// annotation module
// mongodb module
compileOnly("me.qwqdev.library:mongodb:1.0-SNAPSHOT")
}
```
Expand Down

0 comments on commit a0ce642

Please sign in to comment.