Skip to content

Commit

Permalink
Updated README and gemspec
Browse files Browse the repository at this point in the history
  • Loading branch information
djmb committed Oct 2, 2023
1 parent f2db657 commit 5478f91
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ SolidCache is a database-backed ActiveSupport cache store implementation.

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.

Testing on HEY shows that reads and writes are 25%-50% slower than with a Redis cache. However this is not a significant percentage of the overall request time.
Testing on HEY shows that reads and writes are 25%-50% slower than with a Redis cache, but this is not a significant percentage of the overall request time.

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 worth of data.
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.

## Usage

Expand Down Expand Up @@ -39,13 +39,13 @@ Or install it yourself as:
$ gem install solid_cache
```

Add the cache to your main database:
Add the migration to your app:

```bash
$ bin/rails solid_cache:install:migrations
```

Then run migrations:
Then run it:
```bash
$ bin/rails db:migrate
```
Expand Down Expand Up @@ -74,7 +74,7 @@ end

#### Cache configuration

Solid cache supports these options in addition to the universal `ActiveSupport::Cache::Store` options.
Solid cache supports these options in addition to the standard `ActiveSupport::Cache::Store` options.

- `error_handler` - a Proc to call to handle any `ActiveRecord::ActiveRecordError`s that are raises (default: log errors as warnings)
- `expiry_batch_size` - the batch size to use when deleting old records (default: `100`)
Expand Down Expand Up @@ -243,7 +243,24 @@ end
### Index size limits
The SolidCache migrations try to create an index with 1024 byte entries. If that is too big for your database, you should:

1. Manually change in the index size in the migration
1. Edit the index size in the migration
2. Set `max_key_bytesize` on your cache to the new value
## Contributing

## Development

Run the tests with `bin/rails test`. These will run against SQLite.

You can also run the tests against MySQL and Postgres. First start up the databases:

```shell
$ docker compose up -d
```

Then run the tests for the target database
```
$ TARGET_DB=mysql bin/rails test
$ TARGET_DB=postgres bin/rails test
```

## Acknowledgments
SolidCache is MIT-licensed open-source software from 37signals, the creators of Ruby on Rails.
9 changes: 2 additions & 7 deletions solid_cache.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@ Gem::Specification.new do |spec|
spec.authors = [ "Donal McBreen" ]
spec.email = [ "donal@37signals.com" ]
spec.homepage = "http://github.com/basecamp/solid_cache"
spec.summary = "Database backed ActiveSupport cache store"
spec.description = "Database backed ActiveSupport cache store"
spec.summary = "A database backed ActiveSupport::Cache::Store"
spec.description = "A database backed ActiveSupport::Cache::Store"
spec.license = "MIT"

# Prevent pushing this gem to RubyGems.org. To allow pushes either set the "allowed_push_host"
# to allow pushing to a single host or delete this section to allow pushing to any host.
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "http://github.com/basecamp/solid_cache"
spec.metadata["changelog_uri"] = "http://github.com/basecamp/solid_cache/blob/main/CHANGELOG.md"

spec.files = Dir.chdir(File.expand_path(__dir__)) do
Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
Expand Down

0 comments on commit 5478f91

Please sign in to comment.