Preamble:
I have a legacy memcached instance running which interacts with Perl Modules to manage keys.
I can telnet to the server to manually get and set keys.
Problem:
I'm trying to connect to this instance using Ruby/Rails.
Using the Dalli Gem, I've successfully connected to the memcached instance.
I've faced two problems. One using the :meta
protocol. One using the :binary
protocol.
Meta Protocol:
Code:
dc = Dalli::Client.new("<address>:11211", socket_timeout: 2.0, protocol: :meta, namespace: 'ws')
dc.get('item_679')
Output:
Traceback (most recent call last):
1: from (irb):2
Dalli::DalliError (Response error: ERROR)
Log output from Memcached:
<32 new auto-negotiating client connection
32: Client using the ascii protocol
<32 version
>32 VERSION 1.4.4
<32 mg ws:item_679 v f
>32 ERROR
Binary Protocol
Code:
dc = Dalli::Client.new("<address>:11211", socket_timeout: 2.0, protocol: :binary, namespace: 'ws')
dc.get('item_679')
Output:
Traceback (most recent call last):
1: from (irb):5
Dalli::UnmarshalError (Unable to unmarshal value: incompatible marshal file format (can't be read))
format version 4.8 required; 5.9 given
Log output from Memcached:
<38 Read binary protocol data:
<38 0x80 0x00 0x00 0x0b
<38 0x00 0x00 0x00 0x00
<38 0x00 0x00 0x00 0x0b
<38 0x00 0x00 0x00 0x00
<38 0x00 0x00 0x00 0x00
<38 0x00 0x00 0x00 0x00
<38 GET ws:item_679
>38 Writing bin response:
>38 0x81 0x00 0x00 0x00
>38 0x04 0x00 0x00 0x00
>38 0x00 0x00 0x06 0x5f
>38 0x00 0x00 0x00 0x00
>38 0x00 0x00 0x00 0x00
>38 0x00 0x00 0x00 0x00
Versions
- Memcached 1.4.4
- Ruby 2.7
- Dalli 3.2.2
Any ideas on why my requests are coming through strangely?