Git Product home page Git Product logo

Comments (5)

limzykenneth avatar limzykenneth commented on September 24, 2024 1

Seems to be caching now! Thanks.

from wp-rest-api-cache.

airesvsg avatar airesvsg commented on September 24, 2024

Hi @limzykenneth,
The plugin check if something is cached, otherwise it will not continue with all the processes to obtain the data.
The constant WP_DEBUG is active?
Thanks

from wp-rest-api-cache.

limzykenneth avatar limzykenneth commented on September 24, 2024

@airesvsg Sorry, been quite awhile since I used wordpress. Does that mean that this plugin does not set the header for the request asking for the client to cache the results?

from wp-rest-api-cache.

airesvsg avatar airesvsg commented on September 24, 2024

Hi @limzykenneth,
I'll release a new version today with this feature.

wp-content/plugins/wp-rest-api-cache/class-wp-rest-cache.php : 60

if ( $server instanceof WP_REST_Server ) {
    $headers = apply_filters( 'rest_cache_headers', array(), $request_uri, $server, $request );
    if ( ! empty( $headers ) ) {
        $server->send_headers( $headers );
    }
}

wp-content/themes/my-theme/functions.php

add_filter( 'rest_cache_headers', function() {
    return array( 'Cache-Control' => 'max-age=3600' );
} );

from wp-rest-api-cache.

airesvsg avatar airesvsg commented on September 24, 2024

Hi @limzykenneth,
I updated the plugin.
Thanks

from wp-rest-api-cache.

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.