Coder Social home page Coder Social logo

emrikol / focus Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 2.0 832 KB

File-based Object Cache is Utterly Slow: An Object Caching Dropin for WordPress that uses the local file system

Home Page: https://wordpress.org/plugins/focus-object-cache/

License: GNU General Public License v3.0

PHP 95.45% Shell 2.96% JavaScript 1.58%
cache object-cache plugin wordpress

focus's People

Contributors

emrikol avatar szepeviktor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fadlee wprobot

focus's Issues

Remove `WP_CACHE_KEY_SALT` support.

Due to the way that the cache is stored on the filesystem, we don't need to have unique keys per install. Multisite is supported by default, and if more than one WordPress site is using the same installation directory, there's probably much more that will be broken than this cache.

(Props to WordPress.org user @bugnumber9)

Cache Flushing

The cache should be flushed on these instances:

  1. Plugin updating
  2. Plugin deactivation
  3. Plugin activation
  4. Object cache deactivation
  5. Object cache activation

More unit tests

Unit tests are needed for:

  1. Enabling and disabling the drop-in
  2. Enabling and disabling the plugin

OPcache

opcache.validate_timestamps = 0 may prevent functioning properly
as PHP files are not reread.

Cache File Purging

There should be a cron job set up to clear out stale cron files, runs hourly by default but filterable.

Unnecessary double sanitisation and double unslashing

The code in FOCUS_Cache::render_admin_page is double sanitising the $action variable via sanitize_text_field.

First in https://github.com/emrikol/FOCUS/blob/master/focus-cache.php#L126 and for second time in https://github.com/emrikol/FOCUS/blob/master/focus-cache.php#L130

It's really needed only once.

Further, the double wp_unslash call may actually introduce some unwanted bugs. Eg.:

wp> addslashes( "O\'Reilly" );
string(11) "O\\\'Reilly"
wp> wp_unslash( "O\\\'Reilly" );
string(9) "O\'Reilly"
wp> wp_unslash( "O\'Reilly" );
string(8) "O'Reilly"

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.