A summary of data about the Ruby ecosystem.

https://github.com/petergoldstein/dalli

High performance memcached client for Ruby
https://github.com/petergoldstein/dalli

Keywords from Contributors

activerecord activejob mvc rubygems rack rspec background-jobs sidekiq sinatra crash-reporting

Last synced: about 3 hours ago
JSON representation

Repository metadata

High performance memcached client for Ruby

README.md

Dalli Tests

Dalli is a high performance pure Ruby client for accessing memcached servers.

Dalli supports:

  • Simple and complex memcached configurations
  • Failover between memcached instances
  • Fine-grained control of data serialization and compression
  • Thread-safe operation (either through use of a connection pool, or by using the Dalli client in threadsafe mode)
  • SSL/TLS connections to memcached
  • OpenTelemetry distributed tracing (automatic when SDK is present)

The name is a variant of Salvador Dali for his famous painting The Persistence of Memory.

Requirements

  • Ruby 3.3 or later (JRuby also supported)
  • memcached 1.6 or later

Configuration Options

Namespace

Use namespaces to partition your cache and avoid key collisions between different applications or environments:

# All keys will be prefixed with "myapp:"
Dalli::Client.new('localhost:11211', namespace: 'myapp')

# Dynamic namespace using a Proc (evaluated on each operation)
Dalli::Client.new('localhost:11211', namespace: -> { "tenant:#{Thread.current[:tenant_id]}" })

Namespace Separator

By default, the namespace and key are joined with a colon (:). You can customize this with the namespace_separator option:

# Keys will be prefixed with "myapp/" instead of "myapp:"
Dalli::Client.new('localhost:11211', namespace: 'myapp', namespace_separator: '/')

The separator must be a single non-alphanumeric character. Valid examples: :, /, |, ., -, _, #

Security Note

By default, Dalli uses Ruby's Marshal for serialization. Deserializing untrusted data with Marshal can lead to remote code execution. If you cache user-controlled data, consider using a safer serializer:

Dalli::Client.new('localhost:11211', serializer: JSON)

See the 5.0-Upgrade.md guide for upgrade information.

OpenTelemetry Tracing

Dalli automatically instruments operations with OpenTelemetry when the SDK is present. No configuration is required - just add the OpenTelemetry gems to your application:

# Gemfile
gem 'opentelemetry-sdk'
gem 'opentelemetry-exporter-otlp' # or your preferred exporter

When OpenTelemetry is loaded, Dalli creates spans for:

  • Single key operations: get, set, delete, add, replace, incr, decr, etc.
  • Multi-key operations: get_multi, set_multi, delete_multi
  • Advanced operations: get_with_metadata, fetch_with_lock

Span Attributes

All spans include:

  • db.system: memcached
  • db.operation: The operation name (e.g., get, set_multi)

Single-key operations also include:

  • server.address: The memcached server that handled the request (e.g., localhost:11211)

Multi-key operations include cache efficiency metrics:

  • db.memcached.key_count: Number of keys in the request
  • db.memcached.hit_count: Number of keys found (for get_multi)
  • db.memcached.miss_count: Number of keys not found (for get_multi)

Error Handling

Exceptions are automatically recorded on spans with error status. When an operation fails:

  1. The exception is recorded on the span via span.record_exception(e)
  2. The span status is set to error with the exception message
  3. The exception is re-raised to the caller

Zero Overhead

When OpenTelemetry is not present, there is zero overhead - the tracing code checks once at startup and bypasses all instrumentation logic entirely when the SDK is not loaded.

Persistence of Memory

Documentation and Information

  • User Documentation - The documentation is maintained in the repository's wiki.
  • Announcements - Announcements of interest to the Dalli community will be posted here.
  • Bug Reports - If you discover a problem with Dalli, please submit a bug report in the tracker.
  • Forum - If you have questions about Dalli, please post them here.
  • Client API - Ruby documentation for the Dalli::Client API

Development

After checking out the repo, run bin/setup to install dependencies. You can run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Please see CONTRIBUTING.md for guidelines on how to contribute, including our policy on AI-authored contributions.

Appreciation

Dalli would not exist in its current form without the contributions of many people. But special thanks go to several individuals and organizations:

  • Mike Perham - for originally authoring the Dalli project and serving as maintainer and primary contributor for many years
  • Eric Wong - for help using his kgio library.
  • Brian Mitchell - for his remix-stash project which was helpful when implementing and testing the binary protocol support.
  • CouchBase - for their sponsorship of the original development

Authors

Copyright

Copyright (c) Mike Perham, Peter M. Goldstein. See LICENSE for details.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 3 days ago

Total Commits: 1,060
Total Committers: 186
Avg Commits per committer: 5.699
Development Distribution Score (DDS): 0.657

Commits in past year: 104
Committers in past year: 13
Avg Commits per committer in past year: 8.0
Development Distribution Score (DDS) in past year: 0.308

Name Email Commits
Mike Perham m****m@g****m 364
Peter Goldstein p****n@g****m 266
Corin Langosch i****o@n****m 26
Aman Gupta a****n@t****t 26
Brian Lopez s****z@g****m 21
dfens m****p@g****m 17
Dan Mayer d****r@s****m 8
Matt Larraz m****z 7
Graham Cooper g****r@s****m 7
Arthur Neves a****n@g****m 6
Jack Chen (chendo) me@c****o 6
Jean Boussier j****r@g****m 6
Michael Grosser m****l@g****t 6
Steve Richert s****t@g****m 6
dependabot[bot] 4****] 6
Alexander Kahn a****n@g****m 5
Jean byroot Boussier j****b@s****m 5
Joeri Samson j****i@x****m 5
Sebastian Staudt k****r@g****m 5
Brandon Dunne b****e@h****m 5
Rafael Mendonça França r****a@p****r 5
tipair t****s@d****m 5
Olle Jonsson o****n@a****m 5
Naseem Hakim n****m@a****m 4
Jingkai He j****e@g****m 4
Claude n****y@a****m 4
pitr p****n@g****m 4
Donald Plummer d****r@g****m 4
Josh Lewis j****s@g****m 4
Nate Berkopec n****c@g****m 4
and 156 more...

Committer domains:


Issue and Pull Request metadata

Last synced: 9 days ago

Total issues: 50
Total pull requests: 214
Average time to close issues: 5 months
Average time to close pull requests: 24 days
Total issue authors: 41
Total pull request authors: 37
Average comments per issue: 3.3
Average comments per pull request: 1.07
Merged pull request: 160
Bot issues: 0
Bot pull requests: 10

Past year issues: 4
Past year pull requests: 54
Past year average time to close issues: 3 days
Past year average time to close pull requests: 9 days
Past year issue authors: 4
Past year pull request authors: 12
Past year average comments per issue: 1.0
Past year average comments per pull request: 1.2
Past year merged pull request: 39
Past year bot issues: 0
Past year bot pull requests: 7

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/petergoldstein/dalli

Top Issue Authors

  • petergoldstein (6)
  • mecampbellsoup (3)
  • Neustradamus (2)
  • nickamorim (2)
  • ParthivSavani4582 (1)
  • leehsueh (1)
  • cornu-ammonis (1)
  • jshoung (1)
  • matthewzinke (1)
  • Bennet-Sunder (1)
  • justinschier (1)
  • paul-mesnilgrente (1)
  • larouxn (1)
  • xspaniki (1)
  • diegonogueira (1)

Top Pull Request Authors

  • petergoldstein (102)
  • grcooper (14)
  • danmayer (10)
  • dependabot[bot] (10)
  • olleolleolle (10)
  • casperisfine (6)
  • byroot (5)
  • mlarraz (5)
  • sambostock (5)
  • y9v (4)
  • eugeneius (4)
  • PatrickTulskie (4)
  • m-nakamura145 (3)
  • naveg (2)
  • Earlopain (2)

Top Issue Labels

Top Pull Request Labels

  • dependencies (10)
  • github_actions (7)

Package metadata

gem.coop: dalli

High performance memcached client for Ruby

  • Homepage: https://github.com/petergoldstein/dalli
  • Documentation: http://www.rubydoc.info/gems/dalli/
  • Licenses: MIT
  • Latest release: 5.0.2 (published 2 months ago)
  • Last Synced: 2026-04-29T15:49:30.800Z (1 day ago)
  • Versions: 90
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 122,673,084 Total
  • Docker Downloads: 460,961,459
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.113%
    • Downloads: 0.212%
    • Docker downloads count: 0.239%
  • Maintainers (2)
ubuntu-22.04: ruby-dalli

  • Homepage: https://github.com/petergoldstein/dalli
  • Licenses: mit
  • Latest release: 3.0.6-1 (published 3 months ago)
  • Last Synced: 2026-03-13T13:38:05.567Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.116%
    • Forks count: 0.21%
    • Stargazers count: 0.254%
rubygems.org: dalli

High performance memcached client for Ruby

  • Homepage: https://github.com/petergoldstein/dalli
  • Documentation: http://www.rubydoc.info/gems/dalli/
  • Licenses: MIT
  • Latest release: 5.0.2 (published 2 months ago)
  • Last Synced: 2026-04-30T02:00:42.328Z (about 21 hours ago)
  • Versions: 90
  • Dependent Packages: 213
  • Dependent Repositories: 11,488
  • Downloads: 122,704,946 Total
  • Docker Downloads: 460,961,459
  • Rankings:
    • Dependent packages count: 0.181%
    • Downloads: 0.187%
    • Dependent repos count: 0.318%
    • Docker downloads count: 0.448%
    • Average: 0.509%
    • Stargazers count: 0.644%
    • Forks count: 1.277%
  • Maintainers (2)
  • Advisories:
proxy.golang.org: github.com/petergoldstein/dalli

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/petergoldstein/dalli#section-documentation
  • Licenses: mit
  • Latest release: v5.0.2+incompatible (published 2 months ago)
  • Last Synced: 2026-04-27T18:02:58.064Z (3 days ago)
  • Versions: 68
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Stargazers count: 1.244%
    • Forks count: 1.389%
    • Average: 5.753%
    • Dependent packages count: 9.576%
    • Dependent repos count: 10.802%
ubuntu-24.04: ruby-dalli

  • Homepage: https://github.com/petergoldstein/dalli
  • Licenses:
  • Latest release: 3.0.6-2 (published 3 months ago)
  • Last Synced: 2026-03-06T15:58:14.366Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-20.04: ruby-dalli

  • Homepage: https://github.com/petergoldstein/dalli
  • Licenses: mit
  • Latest release: 2.7.9-2 (published 3 months ago)
  • Last Synced: 2026-03-13T20:20:35.243Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-23.10: ruby-dalli

  • Homepage: https://github.com/petergoldstein/dalli
  • Licenses:
  • Latest release: 3.0.6-1.1 (published 3 months ago)
  • Last Synced: 2026-03-14T02:17:00.399Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-11: ruby-dalli

  • Homepage: https://github.com/petergoldstein/dalli
  • Documentation: https://packages.debian.org/bullseye/ruby-dalli
  • Licenses:
  • Latest release: 2.7.11-1 (published 3 months ago)
  • Last Synced: 2026-03-14T06:21:55.078Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-23.04: ruby-dalli

  • Homepage: https://github.com/petergoldstein/dalli
  • Licenses:
  • Latest release: 3.0.6-1.1 (published 3 months ago)
  • Last Synced: 2026-03-11T14:11:24.535Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
guix: ruby-dalli

High performance memcached client for Ruby

  • Homepage: https://github.com/petergoldstein/dalli
  • Documentation: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/ruby-xyz.scm#n5831
  • Licenses: expat
  • Latest release: 3.2.4 (published about 2 months ago)
  • Last Synced: 2026-04-27T16:17:36.682Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-24.10: ruby-dalli

  • Homepage: https://github.com/petergoldstein/dalli
  • Licenses:
  • Latest release: 3.0.6-2 (published 3 months ago)
  • Last Synced: 2026-03-09T17:04:01.809Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-13: ruby-dalli

  • Homepage: https://github.com/petergoldstein/dalli
  • Documentation: https://packages.debian.org/trixie/ruby-dalli
  • Licenses: mit
  • Latest release: 3.2.8-2 (published 3 months ago)
  • Last Synced: 2026-03-14T15:02:14.786Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-12: ruby-dalli

  • Homepage: https://github.com/petergoldstein/dalli
  • Documentation: https://packages.debian.org/bookworm/ruby-dalli
  • Licenses:
  • Latest release: 3.0.6-1.1 (published 3 months ago)
  • Last Synced: 2026-03-13T03:28:42.041Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%

Dependencies

.github/workflows/codeql-analysis.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/rubocop.yml actions
  • actions/checkout v3 composite
  • ruby/setup-ruby v1 composite
.github/workflows/tests.yml actions
  • actions/checkout v3 composite
  • ruby/setup-ruby v1 composite
Gemfile rubygems
  • ruby-prof >= 0 development
dalli.gemspec rubygems
  • connection_pool >= 0 development
  • minitest ~> 5 development
  • rack ~> 2.0, >= 2.2.0 development
  • rake ~> 13.0 development
  • rubocop >= 0 development
  • rubocop-minitest >= 0 development
  • rubocop-performance >= 0 development
  • rubocop-rake >= 0 development
  • simplecov >= 0 development
.github/workflows/benchmarks.yml actions
  • actions/checkout v4 composite
  • ruby/setup-ruby v1 composite
.devcontainer/Dockerfile docker
  • ruby 3.4-bullseye build
.github/workflows/profile.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • ruby/setup-ruby v1 composite
.devcontainer/docker-compose.yml docker

Score: 34.14802273448666