Skip to content

Commit adfa4dd

Browse files
committed
fix docs
1 parent 91706ea commit adfa4dd

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

modules/docs/src/main/mdoc/docs/cache-implementations.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import scalacache.memcached._
2121
import scalacache.serialization.binary._
2222
import cats.effect.IO
2323

24-
implicit val memcachedCache: Cache[IO, String] = MemcachedCache("localhost:11211")
24+
implicit val memcachedCache: Cache[IO, String, String] = MemcachedCache("localhost:11211")
2525
```
2626

2727
or provide your own Memcached client, like this:
@@ -36,7 +36,7 @@ val memcachedClient = new MemcachedClient(
3636
new BinaryConnectionFactory(),
3737
AddrUtil.getAddresses("localhost:11211")
3838
)
39-
implicit val customisedMemcachedCache: Cache[IO, String] = MemcachedCache(memcachedClient)
39+
implicit val customisedMemcachedCache: Cache[IO, String, String] = MemcachedCache(memcachedClient)
4040
```
4141

4242
#### Keys
@@ -65,7 +65,7 @@ import scalacache.redis._
6565
import scalacache.serialization.binary._
6666
import cats.effect.IO
6767

68-
implicit val redisCache: Cache[IO, String] = RedisCache("host1", 6379)
68+
implicit val redisCache: Cache[IO, String, String] = RedisCache("host1", 6379)
6969
```
7070

7171
or provide your own [Jedis](https://github.com/xetorthio/jedis) client, like this:
@@ -78,7 +78,7 @@ import _root_.redis.clients.jedis._
7878
import cats.effect.IO
7979

8080
val jedisPool = new JedisPool("localhost", 6379)
81-
implicit val customisedRedisCache: Cache[IO, String] = RedisCache(jedisPool)
81+
implicit val customisedRedisCache: Cache[IO, String, String] = RedisCache(jedisPool)
8282
```
8383

8484
ScalaCache also supports [sharded Redis](https://github.com/xetorthio/jedis/wiki/AdvancedUsage#shardedjedis) and [Redis Sentinel](http://redis.io/topics/sentinel). Just create a `ShardedRedisCache` or `SentinelRedisCache` respectively.
@@ -101,7 +101,7 @@ import cats.effect.unsafe.implicits.global
101101

102102
implicit val clock: Clock[IO] = Clock[IO]
103103

104-
implicit val caffeineCache: Cache[IO, String] = CaffeineCache[IO, String].unsafeRunSync()
104+
implicit val caffeineCache: Cache[IO, String, String] = CaffeineCache[IO, String, String].unsafeRunSync()
105105
```
106106

107107
This will build a Caffeine cache with all the default settings. If you want to customize your Caffeine cache, then build it yourself and pass it to `CaffeineCache` like this:
@@ -114,7 +114,7 @@ import cats.effect.IO
114114
import cats.effect.unsafe.implicits.global
115115

116116
val underlyingCaffeineCache = Caffeine.newBuilder().maximumSize(10000L).build[String, Entry[String]]
117-
implicit val customisedCaffeineCache: Cache[IO, String] = CaffeineCache(underlyingCaffeineCache)
117+
implicit val customisedCaffeineCache: Cache[IO, String, String] = CaffeineCache(underlyingCaffeineCache)
118118
```
119119

120120
```scala mdoc:invisible

modules/docs/src/main/mdoc/docs/flags.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import cats.effect.unsafe.implicits.global
2929

3030
final case class Cat(id: Int, name: String, colour: String)
3131

32-
implicit val catsCache: Cache[IO, Cat] = MemcachedCache("localhost:11211")
32+
implicit val catsCache: Cache[IO, String, Cat] = MemcachedCache("localhost:11211")
3333

3434
def getCatWithFlags(id: Int)(implicit flags: Flags): Cat = memoize(None) {
3535
// Do DB lookup here...

modules/docs/src/main/mdoc/docs/index.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import scalacache.serialization.binary._
3232

3333
final case class Cat(id: Int, name: String, colour: String)
3434

35-
implicit val catsCache: Cache[IO, Cat] = MemcachedCache("localhost:11211")
35+
implicit val catsCache: Cache[IO, String, Cat] = MemcachedCache("localhost:11211")
3636
```
3737

3838
Note that we made the cache `implicit` so that the ScalaCache API can find it.
@@ -57,7 +57,7 @@ get("eric")
5757
remove("doraemon")
5858

5959
// Flush the cache
60-
removeAll[Cat]
60+
removeAll[String, Cat]
6161

6262
// Wrap any block with caching: if the key is not present in the cache,
6363
// the block will be executed and the value will be cached and returned
@@ -73,9 +73,6 @@ cachingF("benjamin")(ttl = None) {
7373
Cat(2, "Benjamin", "ginger")
7474
}
7575
}
76-
77-
// You can also pass multiple parts to be combined into one key
78-
put("foo", 123, "bar")(ericTheCat) // Will be cached with key "foo:123:bar"
7976
```
8077

8178
```scala mdoc:invisible

modules/docs/src/main/mdoc/docs/memoization.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import cats.effect.IO
1717

1818
final case class Cat(id: Int, name: String, colour: String)
1919

20-
implicit val catsCache: Cache[IO, Cat] = MemcachedCache("localhost:11211")
20+
implicit val catsCache: Cache[IO, String, Cat] = MemcachedCache("localhost:11211")
2121

2222
def getCat(id: Int): IO[Cat] = memoize(Some(10.seconds)) {
2323
// Retrieve data from a remote API here ...

0 commit comments

Comments
 (0)