Giter Club home page Giter Club logo

Comments (3)

sjbronner avatar sjbronner commented on July 29, 2024 1

Before starting, it might be a good idea to see what the underlying cache stores do with the key. Some may already be hashing it. Here are the results of that check:

  • apc: the passed key is combined with a prefix and then used as the final key without any hashing
  • array: the passed key used as the final key without hashing or any other supplemental data
  • database: the passed key is combined with a prefix and then used as the final key without any hashing
  • file: the passed key is sha1-hashed and used as the filename containing the serialized object
  • memcached: the passed key is combined with a prefix and then used as the final key without any hashing
  • redis: the passed key is combined with a prefix string and a sha1-hashed namespace and then used as the final key

So, none of the cache stores hash the key themselves, except for the file store. The database store might get into trouble on older versions of mysql where the maximum key length wasn't that high. Performance could probably be increased with all stores by keeping the keylength down.

from laravel-model-caching.

sjbronner avatar sjbronner commented on July 29, 2024

Choosing a hashing function:

The key hash must not be salted and it has no security implications. SHA1 is fast and has a good collision resistance. It is also widely used when caching. It seems to be a good choice.

For a comparison of hash function properties, see: https://en.wikipedia.org/wiki/SHA-2#Comparison_of_SHA_functions

from laravel-model-caching.

mikebronner avatar mikebronner commented on July 29, 2024

Implemented in release 0.2.18.

from laravel-model-caching.

Related Issues (20)

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.