Giter Site home page Giter Site logo

Comments (4)

balor avatar balor commented on September 14, 2024

Thx for the link.

from connect-memcached.

jasonkarns avatar jasonkarns commented on September 14, 2024

Was #touch implemented?

from connect-memcached.

atuttle avatar atuttle commented on September 14, 2024

@jasonkarns 6c6ffa4

from connect-memcached.

sullivanpt avatar sullivanpt commented on September 14, 2024

By definition "touch" should update the TTL without rewriting the session data. This implementation is broken, as it just exposes "touch" as a synonym for "set". This alias approach has an unwanted side effect that it causes session data to be saved on every route, even when the session was unmodified; this particularly troublesome for web apps that have routes purposely built to not modify the session so they can run in parallel.

It would be better to not expose "touch" at all so express-session's built in modification logic will work correctly.

i'm a memcached noob, but digging deeper I noticed that memcached server does implement touch, but it doesn't do so until 1.4.8. In my anecdotal experience this is too new for many deployments, so fixing "touch" correctly would break this module for many users.

So that leaves a few options for a fix:

  • remove the bogus "touch" as "set" alias and update the docs to state touch isn't supported.
  • add a flag options.serverSupportsTouch and switch our touch implementation between "touch" or the old "set" behavior dynamically. This is my favorite as it guarantees not breaking anybody that depends on the existing build.
  • similar to above but rely on client.version callback to switch implementations. I'm very not fond of this approach because it seems version detection is brittle for customer memcached builds.

Happy to make a PR for your favorite of the above. Thanks.

from connect-memcached.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.