Giter Club home page Giter Club logo

simple-cache's Introduction

PHP Safe cache

read&write content in concurrent environments (suitable for large amounts of data)

Caching content and generally reading and creating files requires some kind of locking mechanism. Many libraries are lacking in this area as are not paying too much attention to properly implement locking which leads to data corruption and/or higher cpu load times.

So what should be desired behavior when having hundreds of concurrent threads which are competing to read and write to a single file?

  • only one publisher thread at the same time, the rest should be readers
  • publisher has a duty to generate/publish new content when old expires
  • new content generation may take some time, but it should not prevent readers from accessing current cache
  • readers only read the content or wait for it if old has expired
  • to minimize readers wait time (majority of threads!) cached content for publisher should expire sooner (5-15 sec)

TODO

  • write Cache Lite drop in replacement with examples
  • finding alternative to flock() for shared and exclusive locks
  • not tested under win32

BUGS

simple-cache's People

Contributors

mpapec avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

fecori

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.