Dalli is a high performance pure Ruby client for accessing memcached servers.
Dalli solves the problem of efficiently caching data in Ruby applications by providing a direct interface to memcached. The client handles the memcached protocol and connection management, offering both simple and complex server configurations with automatic failover between instances. It provides fine-grained control over data serialization and compression, allowing developers to optimize for their specific use cases. The tool operates in a thread-safe manner through either a connection pool or a dedicated threadsafe mode, and supports encrypted connections via SSL/TLS.
Dalli suits Ruby applications that need reliable, high-performance caching backed by memcached infrastructure. It is particularly valuable for applications handling user-controlled cached data, since it allows switching from the default Marshal serializer to safer alternatives to prevent deserialization attacks. The tool integrates automatically with OpenTelemetry when the SDK is present, instrumenting cache operations with distributed tracing spans that include operation names, server addresses, and cache hit/miss metrics without requiring manual configuration. When OpenTelemetry is absent, there is zero instrumentation overhead.
The project maintains active test coverage against both minimum and latest memcached versions, ensuring compatibility across supported server releases. Development activity shows consistent attention to security practices, including explicit guidance on serialization risks and upgrade documentation for major versions. The codebase demonstrates responsiveness to operational concerns through features like namespace partitioning to prevent key collisions and customizable namespace separators for different deployment scenarios.