<?xml version="1.0" encoding="utf-8" standalone="yes"?><feed xmlns="http://www.w3.org/2005/Atom">
  <title></title>
  <subtitle></subtitle>
  <id>https://www.endpointdev.com/blog/tags/redis/</id>
  <link href="https://www.endpointdev.com/blog/tags/redis/"/>
  <link href="https://www.endpointdev.com/blog/tags/redis/" rel="self"/>
  <updated>2026-06-16T00:00:00+00:00</updated>
  <author>
    <name>End Point Dev</name>
  </author>
  
    <entry>
      <title>Interchange Redis Sessions</title>
      <link rel="alternate" href="https://www.endpointdev.com/blog/2026/06/interchange-redis-sessions/"/>
      <id>https://www.endpointdev.com/blog/2026/06/interchange-redis-sessions/</id>
      <published>2026-06-16T00:00:00+00:00</published>
      <author>
        <name>Mark Johnson</name>
      </author>
      <content type="html">
        &lt;p&gt;&lt;img src=&#34;/blog/2026/06/interchange-redis-sessions/cover.webp&#34; alt=&#34;An eastern bluebird with a rust-orange breast and blue-gray head perched on a bare branch, set against a soft blue sky with white clouds.&#34;&gt;&lt;br&gt;
Photo by Josh Ausborne, 2022.&lt;/p&gt;
&lt;p&gt;Interchange&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; now supports storing user sessions in Redis&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;, an in-memory data store, as a core feature of Interchange 5.12. Sessions are where Interchange keeps client state that makes a catalog operate as a continuous experience&amp;ndash;the shopping cart, form values, login status, and other data that persist from one request to the next. How and where that state is stored have a direct impact on a busy catalog&amp;rsquo;s performance, and Redis gives developers a fast, purpose-built option that sits alongside the storage backends Interchange has always offered.&lt;/p&gt;
&lt;h3 id=&#34;session-storage-in-interchange&#34;&gt;Session storage in Interchange&lt;/h3&gt;
&lt;p&gt;By default, Interchange writes each session to a file on disk, and it has long been able to store sessions in a relational database instead by way of &lt;code&gt;Vend::SessionDB&lt;/code&gt;, configured with the &lt;code&gt;SessionType DBI&lt;/code&gt; and &lt;code&gt;SessionDB&lt;/code&gt; directives. The database approach is the natural choice once a catalog is served by more than one Interchange server, since every server needs to read and write the same pool of sessions.&lt;/p&gt;
&lt;p&gt;Relational databases certainly can function in this capacity, but a high-traffic session table is not where they shine. Every page view reads, writes, and locks a session row, and that constant churn competes with database performance for the application. Redis is built precisely for this kind of small, hot, frequently updated key/value data, and that makes it a compelling choice for session storage.&lt;/p&gt;
&lt;h3 id=&#34;using-redis-for-sessions&#34;&gt;Using Redis for sessions&lt;/h3&gt;
&lt;p&gt;Enabling Redis sessions takes two directives in your catalog&amp;rsquo;s &lt;code&gt;catalog.cfg&lt;/code&gt;. Set &lt;code&gt;SessionType&lt;/code&gt; to &lt;code&gt;Redis&lt;/code&gt;, and point &lt;code&gt;SessionDB&lt;/code&gt; at the address and port of your Redis server:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Variable REDIS_SERVER 127.0.0.1:6379
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SessionType Redis
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SessionDB   __REDIS_SERVER__&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;That is the whole of the required configuration. Behind the scenes, the new &lt;code&gt;Vend::SessionRedis&lt;/code&gt; module ties Interchange&amp;rsquo;s session storage to Redis through the standard Redis CPAN module&lt;sup id=&#34;fnref:3&#34;&gt;&lt;a href=&#34;#fn:3&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;3&lt;/a&gt;&lt;/sup&gt;, so Redis and that module must be installed and reachable from your Interchange host.&lt;/p&gt;
&lt;p&gt;Redis sessions also work optionally with the session compression recently introduced.&lt;sup id=&#34;fnref:4&#34;&gt;&lt;a href=&#34;#fn:4&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;4&lt;/a&gt;&lt;/sup&gt; If you set &lt;code&gt;SessionDBCompression&lt;/code&gt; to a viable compression algorithm, session data is compressed on the way into Redis and decompressed on the way out, exactly as it is for database sessions:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SessionDBCompression Zstd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id=&#34;more-lists-and-moredbtable&#34;&gt;More lists and MoreDBTable&lt;/h3&gt;
&lt;p&gt;Some catalogs use Interchange&amp;rsquo;s MoreDB feature to cache search-result sets (&amp;ldquo;more&amp;rdquo; lists) into the session database rather than writing to files on disk. This feature is often leveraged for the same reason that &lt;code&gt;SessionDB&lt;/code&gt; is used: to support a distributed, load-balanced server environment. &lt;code&gt;MoreDB&lt;/code&gt; relies on a real database table, and Redis&amp;ndash;having no support in Interchange&amp;rsquo;s database abstraction layer&amp;ndash;cannot provide one. To bridge that gap, there is a new &lt;code&gt;MoreDBTable&lt;/code&gt; directive that tells &lt;code&gt;MoreDB&lt;/code&gt; which relational table to use for more lists, independent of where sessions themselves live:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;MoreDB yes
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ifdef REDIS_SERVER
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   include dbconf/__SESSIONDB_ENGINE__/sessions.__SESSIONDB_ENGINE__.__MOREDB_EXT__
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   MoreDBTable sessions
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;endif&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;When you run Redis sessions together with &lt;code&gt;MoreDB&lt;/code&gt;, &lt;code&gt;MoreDBTable&lt;/code&gt; is required. Without Redis it remains optional: &lt;code&gt;MoreDB&lt;/code&gt; falls back to &lt;code&gt;SessionDB&lt;/code&gt; just as it always has. The strap demo ships ready-made schema definitions for MySQL, PostgreSQL, and SQLite, so the supporting table is created with the right column types.&lt;/p&gt;
&lt;h3 id=&#34;locking-and-a-friendlier-welcome-for-bots&#34;&gt;Locking and a friendlier welcome for bots&lt;/h3&gt;
&lt;p&gt;Concurrent requests for the same session have to be serialized so two clicks don&amp;rsquo;t trample each other&amp;rsquo;s data. For this release, the RDBMS session backend was reworked to lock session records with proper database transactions rather than the old approach of inserting and deleting lock rows. Redis gets its own locking scheme built on Redis&amp;rsquo;s atomic &lt;code&gt;SETNX&lt;/code&gt; (&amp;ldquo;set if not exists&amp;rdquo;) operation, exposed through a new &lt;code&gt;has_lock()&lt;/code&gt; method. The mechanism is general enough that any other storage system able to offer the same primitive&amp;ndash;Memcached, for example&amp;ndash;could adopt it.&lt;/p&gt;
&lt;p&gt;Redis sessions add one more practical refinement. Automated crawlers generate an enormous number of &amp;ldquo;hit and run&amp;rdquo; sessions that are created once and never used again, and on a database-backed catalog they pile up until something prunes them. &lt;code&gt;Vend::SessionRedis&lt;/code&gt; instead gives every brand-new session a fixed 30-minute expiration. A human user comfortably makes a second request within that window, at which point the session is promoted to the full lifetime set by your &lt;code&gt;SessionExpire&lt;/code&gt; directive. A bot that never returns simply expires on its own quickly, limiting data bloat, and Redis reclaims the memory without any housekeeping on your part.&lt;/p&gt;
&lt;h3 id=&#34;wrapping-up&#34;&gt;Wrapping up&lt;/h3&gt;
&lt;p&gt;Redis sessions give Interchange developers a fast, horizontally scalable place to keep session state, with optional compression, a robust locking model, and built-in resistance to bot-driven session bloat&amp;ndash;all configured with a couple of lines in &lt;code&gt;catalog.cfg&lt;/code&gt;. As with the rest of Interchange, the implementation lives in core and is open for the community to extend; the &lt;code&gt;has_lock()&lt;/code&gt; interface in particular invites support for additional storage backends.&lt;/p&gt;
&lt;h3 id=&#34;references&#34;&gt;References&lt;/h3&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;&lt;a href=&#34;https://www.interchangecommerce.org&#34;&gt;Interchange - https://www.interchangecommerce.org&lt;/a&gt;&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;&lt;a href=&#34;https://redis.io/&#34;&gt;Redis - https://redis.io/&lt;/a&gt;&amp;#160;&lt;a href=&#34;#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:3&#34;&gt;
&lt;p&gt;&lt;a href=&#34;https://metacpan.org/pod/Redis&#34;&gt;Perl&amp;rsquo;s Redis module on CPAN - https://metacpan.org/pod/Redis&lt;/a&gt;&amp;#160;&lt;a href=&#34;#fnref:3&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:4&#34;&gt;
&lt;p&gt;&lt;a href=&#34;https://www.endpointdev.com/blog/2025/04/interchange-compress-sessiondb/&#34;&gt;Interchange Compression for SessionDB&lt;/a&gt;&amp;#160;&lt;a href=&#34;#fnref:4&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;

      </content>
    </entry>
  
</feed>
