mysql_cache_store v0.2.0
Cache::MySqlCacheStore
A cache store implementation which stores everything in the MySQL database, using crystal-mysql as the backend.
Installation
-
Add the dependency to your
shard.yml
:dependencies: mysql_cache_store: github: crystal-cache/mysql_cache_store
-
Run
shards install
Usage
Before using this shard make sure you have created MySQL database. For example cache_production
:
mysql -u root
mysql> CREATE DATABASE cache_production character set utf8mb4 collate utf8mb4_unicode_ci;
A MySQL database can be opened with:
db = DB.open("mysql://root@localhost/cache_production")
Open and use the new cache instance:
require "mysql_cache_store"
cache = Cache::MySqlCacheStore(String, String).new(1.minute, db)
cache.write("foo", "bar")
cache.read("foo") # => "bar"
Development
Run specs
Before run specs make sure you have created MySQL database `cache_test
mysql -u root
mysql> CREATE DATABASE cache_test character set utf8mb4 collate utf8mb4_unicode_ci;
crystal spec
Contributing
- Fork it (https://github.com/crystal-cache/mysql_cache_store/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Anton Maminov - creator and maintainer
Repository
mysql_cache_store
Owner
Statistic
- 1
- 0
- 0
- 0
- 3
- about 2 years ago
- October 27, 2021
License
MIT License
Links
Synced at
Thu, 21 Nov 2024 02:16:01 GMT
Languages