0.0
No release in over 3 years
Leveraging https://github.com/tidwall/pogocache as a C extension.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 13.0
~> 3.12
~> 0.22
~> 1.50
~> 0.9
 Project Readme

Pogocache::Ruby

Use pogocache as an in-memory store in Ruby. This gem embeds pogocache as a C extension and provides the class Pogocache::Cacheto interact with it. The goal is to provide a faster, more lightweight alternative to ActiveSupport::Cache::MemoryStore. The state of this project is pre release but functional. Feedback is welcome.

Features

  • Fast caching operations
  • Low memory footprint
  • Arbitrary objects as keys and values
  • Linux and MacOS support

Threading

This gem relies on the GVL when used in a multi-threaded context. It does not free the lock before any operation.

Usage

bundle add pogocache-ruby
require 'pogocache-ruby'

cache = Pogocache::Cache.new

cache.set("value1", "string 1")
cache[:value2] = { hash_key: "value" }

cache.fetch(:value2)
# => {hash_key: "value"}
cache["value1"]
# => "string 1"

See pogocache_spec.rb and pogocache.h for details.

Benchmark

benchmark.rb

Benchmarking WRITE performance (100000 keys)...
                           user     system      total        real
MemoryStore write:     0.526285   0.020191   0.546476 (  0.546561)
Pogocache write:       0.087404   0.003957   0.091361 (  0.091385)

Benchmarking READ performance (100000 keys)...
                           user     system      total        real
MemoryStore read:      0.302697   0.004301   0.306998 (  0.307099)
Pogocache read:        0.104694   0.000000   0.104694 (  0.104700)

Benchmarking memory performance (100000 keys)...
Calculating -------------------------------------
        MemoryStore:   232.000M memsize (     8.000M retained)
                         2.200M objects (   100.000k retained)
                        50.000  strings (     0.000  retained)
          Pogocache:    52.000M memsize (     0.000  retained)
                       700.000k objects (     0.000  retained)
                        50.000  strings (     0.000  retained)

License

This gem uses Pogocache. Pogocache is free & open source software released under the terms of the AGPL license. The Pogocache source code was written and copyrighted by Polypoint Labs, LLC.

For alternative licensing options, please contact them at licensing@polypointlabs.com.