Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A Rails/Rack cache backed by Postgres unlogged tables

License

NotificationsYou must be signed in to change notification settings

csuhta/postgres-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A work in progress, not production ready.

PostgresCache is a Rails/Rack cache backed by a PostgresUNLOGGED table andbytea column.

How to use:

# This will create the table `application_cache` in your databasecache=PostgresCache.new("YOUR_POSTGRES_DATABASE_URL",table_name:"application_cache")# Now you can store any Ruby object that can be marshaled in the database under a keycache.write("your key","some value")cache.exists?("your key")cache.read("your key")cache.fetch("another key")do"default value if not exists"endcache.delete("your key")cache.clear

There is a wrapper for use as a Rails.cache:

Rails.application.config.cache=ActiveSupport::Cache::Postgres.new("YOUR_POSTGRES_DATABASE_URL")

Or as a Rack::Cache (not working correctly yet):

entity_store=Rack::Cache::EntityStore::Postgres.new("YOUR_POSTGRES_DATABASE_URL")meta_store=Rack::Cache::MetaStore::Postgres.new("YOUR_POSTGRES_DATABASE_URL")

About

A Rails/Rack cache backed by Postgres unlogged tables

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp