[wp-trac] [WordPress Trac] #19879: Better caching for get_dirsize

WordPress Trac noreply at wordpress.org
Mon Oct 5 15:35:13 UTC 2020


#19879: Better caching for get_dirsize
-------------------------------------------------+-------------------------
 Reporter:  batmoo                               |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  5.6
Component:  Filesystem API                       |     Version:  3.3.1
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback needs-unit-   |     Focuses:  multisite,
  tests                                          |  performance
-------------------------------------------------+-------------------------

Comment (by janthiel):

 I just added another patch file. It includes one additional filter which
 will alow one to change the calculation of the dirsize without losing the
 new caching benefits.

 Currently one can only use the {{{pre_get_space_used}}} filter which then
 required to either duplicate large parts of the actual {{{get_dirsize}}}
 and {{{recurse_dirsize}}} functions or lose the benefits of the new
 caching.
 The new filter allows for custom code to run per directory and the result
 will fill the dirsize_cache. Yet the previous existing filter
 {{{pre_get_space_used}}} can still be used to implement a complete own
 space calculation which might or might not rely on the dirsize_cache. So
 there will be complete backward compatibility for those who implemented
 their own logic.

 Particular use cases for the new filter are:
 - Calling CDN APIs to get the actual usage of the requested directory
 - Implement custom logic benefiting from deep integration into native
 operating system tools for much faster calculations (like {{{du}}} on
 unix)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/19879#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list