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
- Host: GitHub
- URL: https://github.com/petergoldstein/dalli
- Owner: petergoldstein
- License: mit
- Created: 2010-08-17T16:56:58.000Z (over 15 years ago)
- Default Branch: main
- Last Pushed: 2026-04-21T04:52:09.000Z (10 days ago)
- Last Synced: 2026-04-25T17:10:37.578Z (5 days ago)
- Language: Ruby
- Homepage:
- Size: 1.58 MB
- Stars: 3,114
- Watchers: 50
- Forks: 465
- Open Issues: 2
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: code_of_conduct.md
README.md
Dalli 
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:memcacheddb.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 requestdb.memcached.hit_count: Number of keys found (forget_multi)db.memcached.miss_count: Number of keys not found (forget_multi)
Error Handling
Exceptions are automatically recorded on spans with error status. When an operation fails:
- The exception is recorded on the span via
span.record_exception(e) - The span status is set to error with the exception message
- 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.

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::ClientAPI
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
- Peter M. Goldstein - current maintainer
- Mike Perham and contributors
Copyright
Copyright (c) Mike Perham, Peter M. Goldstein. See LICENSE for details.
Owner metadata
- Name: Peter Goldstein
- Login: petergoldstein
- Email:
- Kind: user
- Description:
- Website:
- Location: Raleigh, NC
- Twitter: petergoldstein
- Company:
- Icon url: https://avatars.githubusercontent.com/u/421488?u=b7bba737453f0ac9a5ab6d1cefd6a153b1ed3e22&v=4
- Repositories: 37
- Last ynced at: 2023-03-11T06:10:43.474Z
- Profile URL: https://github.com/petergoldstein
GitHub Events
Total
- Delete event: 23
- Member event: 2
- Pull request event: 67
- Fork event: 14
- Issues event: 13
- Watch event: 39
- Issue comment event: 78
- Push event: 72
- Pull request review comment event: 29
- Pull request review event: 48
- Gollum event: 2
- Create event: 20
Last Year
- Delete event: 22
- Pull request event: 33
- Fork event: 7
- Issues event: 9
- Watch event: 20
- Issue comment event: 53
- Push event: 60
- Pull request review event: 13
- Pull request review comment event: 2
- Create event: 16
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 | 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:
- shopify.com: 7
- notonthehighstreet.com: 2
- mobalean.com: 2
- redhat.com: 2
- carbonfive.com: 2
- phlippers.net: 1
- code.org: 1
- icantclick.org: 1
- me.com: 1
- jklabs.net: 1
- intercom.io: 1
- nmilne.com: 1
- highgroove.com: 1
- aloop.org: 1
- z33k.com: 1
- mail.ru: 1
- sleekcode.net: 1
- broadcastingadam.com: 1
- stackpilot.com: 1
- karnovgroup.com: 1
- clarityservices.com: 1
- omgpop.com: 1
- dblock.org: 1
- netskin.com: 1
- tmm1.net: 1
- chen.do: 1
- grosser.it: 1
- xaop.com: 1
- plataformatec.com.br: 1
- drw.com: 1
- auctionet.com: 1
- airbnb.com: 1
- anthropic.com: 1
- mrhead.sk: 1
- dimelo.com: 1
- shevtsov.me: 1
- godfat.org: 1
- oobak.org: 1
- jjb.cc: 1
- laibe.cc: 1
- amitlevy.com: 1
- coinbase.com: 1
- gun.io: 1
- hermestechnologies.ie: 1
- gateguruapp.com: 1
- stefanwillle.com: 1
- vrensk.com: 1
- davidterei.com: 1
- dio.jp: 1
- mediadrive.ca: 1
- alumni.cs.utexas.edu: 1
- unboxed.co: 1
- sorentwo.com: 1
- nathanielbibler.com: 1
- zopim.com: 1
- markcharles.dev: 1
- valuestream.io: 1
- kevinwatt.org: 1
- ifttt.com: 1
- joao-carlos.com: 1
- bespokepost.com: 1
- glenngillen.com: 1
- bunnymatic.com: 1
- access-company.com: 1
- getharvest.com: 1
- illinois.edu: 1
- steveklabnik.com: 1
- engineyard.com: 1
- sj26.com: 1
- ryanlchan.com: 1
- mailworks.org: 1
- peterhiggins.org: 1
- codified.co: 1
- platform45.com: 1
- arthurnn.com: 1
- code42.com: 1
- academia.edu: 1
- unity3d.com: 1
- edwardog.net: 1
- yhbt.net: 1
- twitter.com: 1
- macreery.com: 1
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
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
- Total packages: 13
-
Total downloads:
- rubygems: 245,378,030 total
- Total docker downloads: 921,922,918
- Total dependent packages: 213 (may contain duplicates)
- Total dependent repositories: 11,488 (may contain duplicates)
- Total versions: 258
- Total maintainers: 2
- Total advisories: 1
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
- actions/checkout v3 composite
- github/codeql-action/analyze v2 composite
- github/codeql-action/autobuild v2 composite
- github/codeql-action/init v2 composite
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
- ruby-prof >= 0 development
- 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
- actions/checkout v4 composite
- ruby/setup-ruby v1 composite
- ruby 3.4-bullseye build
- actions/checkout v4 composite
- actions/upload-artifact v4 composite
- ruby/setup-ruby v1 composite
Score: 34.14802273448666