Coder Social home page Coder Social logo

Comments (9)

mevdschee avatar mevdschee commented on June 11, 2024 1

Thank you for your kind words.

could it be configured to have no cache for the users table, a 24-hour cache for the content table, and a one-month cache for the site_infos table ?

No, this is not supported (yet). Note that the cache only caches the structure and not the data.

Kindest regards Maurits

from php-crud-api.

mevdschee avatar mevdschee commented on June 11, 2024 1

Integrating support for TempFile cache for specific tables and responses would be a fantastic enhancement

And how would this improve performance measurably? Is your database remote and very slow?

from php-crud-api.

mevdschee avatar mevdschee commented on June 11, 2024 1

Since the read operations are HTTP GET requests, you could write a customizationHandler that adds caching headers to the response. This could reduce the actual number of http requests. This would only help if your (ajax?) client would respect those headers. I think this could improve real world performance (at the cost of consistency).

NB: Next thing you'll be asking is implementing cache invalidation on write operations ;-) (joke, not serious)

NB2: Last comment is a reference to the 'hard things' in software engineering, see: https://martinfowler.com/bliki/TwoHardThings.html

from php-crud-api.

mevdschee avatar mevdschee commented on June 11, 2024 1

I'll re-open this issue if you actually use the software and have measurable performance problems. I can then help you to analyze and improve (real-world) performance.

from php-crud-api.

khalilghenimi avatar khalilghenimi commented on June 11, 2024

Thank you so much for your quick response! It's greatly appreciated.

Integrating support for TempFile cache for specific tables and responses would be a fantastic enhancement, potentially boosting the speed and efficiency of the apps using the API. I'm so grateful for your great work.

from php-crud-api.

khalilghenimi avatar khalilghenimi commented on June 11, 2024

In scenarios where we're building a flat CMS or dealing with content-heavy applications, and experiencing high traffic volumes, caching becomes especially valuable. Articles and static content, which don't change frequently, are prime candidates for caching to optimize performance. On the other hand, tables like comments and user data need to be updated more frequently to reflect real-time interactions and changes within the system.

By implementing a flexible caching mechanism that allows us to selectively cache specific tables, we can tailor the caching strategy to suit the needs of different types of data. This approach ensures that we strike the right balance between performance optimization and data freshness.

from php-crud-api.

mevdschee avatar mevdschee commented on June 11, 2024

In scenarios where we're building a flat CMS or dealing with content-heavy applications, and experiencing high traffic

As a performance engineer I'm very familiar with high traffic applications and static sites. Static site generators should pull the data in (right?), so caching in the API is not needed. Content heavy applications need a local database. With the current speed of disk drives the number of http requests seems more important to me than the number of queries. Especially when those queries are on the localhost and the http requests over the network. Thus my questions about the performance problems you are measuring.

this approach ensures that we strike the right balance between performance optimization and data freshness.

Caching hurts consistency and the acceptable trade-offs are very application specific and related to the bad performance (capacity and high traffic) of specific end-points. Even if we had a generic way to implement this I wouldn't know a generic way to configure this. I also (see point made above) doubt that you are caching at the right level (on a higher level would allow you to be more application/use-case specific).

from php-crud-api.

khalilghenimi avatar khalilghenimi commented on June 11, 2024

you could write a customizationHandler that adds caching headers to the response. This could reduce the actual number of http requests. This would only help if your (ajax?) client would respect those headers. I think this could improve real world performance (at the cost of consistency).

Could you please provide additional clarification on this matter?

NB: Next thing you'll be asking is implementing cache invalidation on write operations ;-) (joke, not serious)

Why not xD

NB2: Last comment is a reference to the 'hard things' in software engineering, see: https://martinfowler.com/bliki/TwoHardThings.html

That's quite impressive!

from php-crud-api.

mevdschee avatar mevdschee commented on June 11, 2024

Could you please provide additional clarification on this matter?

Sure, read more about HTTP caching here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching

Why not xD

Because it is hard (and therefor should be avoided, if possible).

from php-crud-api.

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.