cuaderno de campo

anotaciones

Menú
  • casa
    • dinou del carrer nou
  • cocina
    • pan
    • repostería
    • verdura
  • huerto
    • plano del número 29
    • huerto del año 2023
  • humanidades
    • fonoteca
    • galería
  • juego
    • colección de roms
    • lista de juegos
    • dosbox
  • linux
    • bash
    • sistema operativo
    • ssh
  • web
    • apache
    • css
    • html5
    • javascript
    • mysql
    • php
Menú

manejo de la caché

Publicado el 1 de diciembre de 201726 de febrero de 2021 por ernesto
<IfModule mod_expires.c>
     ExpiresActive On
     ExpiresDefault "access plus 5 seconds"
     ExpiresByType image/x-icon "access plus 2592000 seconds"
     ExpiresByType image/jpeg "access plus 2592000 seconds"
     ExpiresByType image/png "access plus 2592000 seconds"
</IfModule>

la directiva expiresbytype (mod_expires) define el tiempo adicional de las cabeceras expires y cache-control (directiva max-age) de los archivos del tipo mime indicado: «access plus 2592000 seconds» (por ejemplo). la directiva max-age de cache-control

Specifies the maximum amount of time a resource will be considered fresh.

«Cache-Control» de MDN web docs.

el tiempo adicional se debe expresar en segundos. estas cabeceras también se pueden definir mediante las directivas de mod_headers:

<IfModule mod_headers.c>
     <FilesMatch "(.html|.php)$">
          Header set Cache-Control "private, max-age=1"
     </FilesMatch>
     <FilesMatch "^(?!(.*.html|.*.php)$).*$">
          Header set Cache-Control "public, max-age=604800"
     </FilesMatch>
</IfModule>

en este caso, la directiva header se aplica a los archivos según su extensión: en primer lugar, se aplica «private, max-age=1» a aquellos archivos cuya extensión sea html o php; en segundo lugar, sucede al contrario (negative lookahead), esto es, se aplica «max-age=604800» a todos aquellos archivos cuya extensión no sea html o php:

Specifies a group that can not match after the main expression (if it matches, the result is discarded).

«negative lookahead» de RegExr.

en cuanto a las directivas public y private de http,

The «public» response directive indicates that any cache MAY store the response, even if the response would normally be non-cacheable or cacheable only within a private cache.

«public» de RFC 7234.

The «private» response directive indicates that the response message is intended for a single user and MUST NOT be stored by a shared cache.

«private» de RFC 7234.

es posible, además, deshabilitar la caché a discreción:

<FilesMatch ".(pl|php|cgi|spl|scgi|fcgi)$">
     Header unset Cache-Control
</FilesMatch>

o destotro modo,

<FilesMatch ".(pl|php|cgi|spl|scgi|fcgi)$">
     ExpiresActive Off
</FilesMatch>

fuente: dreamhost.com.

Etiquetado como cache-control, expires, expiresactive, expiresbytype, expiresdefault, filesmatch, header, max-age, private, public, regexp
  • Freeciv
    freeciv

    The Freeciv Project, Freeciv, 1996-2017 sudo apt-cache show freeciv Freeciv is a free clone of…

  • Seven Kingdoms Ancient Adversaries
    seven kingdoms

    Trevor Chan, Seven Kingdoms Ancient Adversaries, 2009 sudo apt-cache show 7kaa Seven Kingdoms, designed by…

  • desactivación de las etags

    FileETag None <IfModule mod_headers.c> Header unset ETag </IfModule> esta es la manera de excluir el…

RSS rutas fuera

  • Plague Bearer – Summoning Apocalyptic Devastation (2023) 18 de septiembre de 2023 Belisario
  • Yetis en España, con Javier Resines, en Angulo 13 16 de septiembre de 2023 Javier Resines
  • Sadistic Metal Reviews: Metal Jihad Edition 11 de septiembre de 2023 Brett Stevens
  • Beats and yelling shorts, 6th September 23 6 de septiembre de 2023 Hate Meditations
  • Cemetery Urn – Suffer the Fallen (2023) 3 de septiembre de 2023 Brett Stevens
  • Necropolis #75 – On Norwegian Black Metal 3 de septiembre de 2023 Hate Meditations
  • Beats and yelling: Horrendous cut the ribbon on their long awaited Funhouse 28 de agosto de 2023 Hate Meditations
  • Complete Snake release Red Hog 28 de agosto de 2023 hessianfirm
  • Beats and yelling shorts, 26th August 23 26 de agosto de 2023 Hate Meditations

Categorías

apache bash casa cocina corral css exterior fonoteca galería html5 huerto humanidades humanidades digitales interior jardín javascript juego linux mysql pan php repostería sistema operativo ssh verdura web

Archivo

cuaderno de campo 2011-2023