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
Copy file name to clipboardExpand all lines: README.md
+39-66
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,11 @@
1
1
# Solid Cache
2
2
3
-
**Upgrading from v0.3.0 or earlier? Please see [upgrading to version 0.4.0](upgrading_to_version_0.4.x.md)**
3
+
**Upgrading from v0.3.0 or earlier? Please see [upgrading to version v0.4.x and beyond](upgrading_to_version_0.4.x.md)**
4
4
5
5
Solid Cache is a database-backed Active Support cache store implementation.
6
6
7
7
Using SQL databases backed by SSDs we can have caches that are much larger and cheaper than traditional memory only Redis or Memcached backed caches.
8
8
9
-
Testing on [HEY](https://hey.com) shows that reads and writes are 25%-50% slower than with a Redis cache (1.2ms vs 0.8-1ms per single-key read), but this is not a significant percentage of the overall request time.
10
-
11
-
If cache misses are expensive (up to 50x the cost of a hit on HEY), then there are big advantages to caches that can hold months rather than days of data.
12
-
13
9
## Usage
14
10
15
11
To set Solid Cache as your Rails cache, you should add this to your environment config:
@@ -18,7 +14,7 @@ To set Solid Cache as your Rails cache, you should add this to your environment
18
14
config.cache_store =:solid_cache_store
19
15
```
20
16
21
-
Solid Cache is a FIFO (first in, first out) cache. While this is not as efficient as an LRU cache, this is mitigated by the longer cache lifespans.
17
+
Solid Cache is a FIFO (first in, first out) cache. While this is not as efficient as an LRU cache, this is mitigated by the longer cache lifespan.
22
18
23
19
A FIFO cache is much easier to manage:
24
20
1. We don't need to track when items are read
@@ -55,7 +51,7 @@ $ bin/rails db:migrate
55
51
56
52
### Configuration
57
53
58
-
Configuration will be read from solid_cache.yml. You can change the location of the config file by setting the `SOLID_CACHE_CONFIG` env variable.
54
+
Configuration will be read from `config/solid_cache.yml`. You can change the location of the config file by setting the `SOLID_CACHE_CONFIG` env variable.
If `connects_to` is set it will be passed directly.
101
97
98
+
If none of these are set, then Solid Cache will use the `ActiveRecord::Base` connection pool. This means that cache reads and writes will be part of any wrapping
99
+
database transaction.
100
+
102
101
#### Engine configuration
103
102
104
-
There are two options that can be set on the engine:
103
+
There are three options that can be set on the engine:
105
104
106
105
- `executor`- the [Rails executor](https://guides.rubyonrails.org/threading_and_code_execution.html#executor) used to wrap asynchronous operations, defaults to the app executor
107
106
- `connects_to`- a custom connects to value for the abstract `SolidCache::Record` active record model. Required for sharding and/or using a separate cache database to the main app. This will overwrite any value set in `config/solid_cache.yml`
@@ -111,12 +110,7 @@ These can be set in your Rails configuration:
0 commit comments