Saltar al contenido

cuaderno de campo

anotaciones

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

manejo de la caché

Publicada 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

  • CAMINANDO ENTRE MONSTRUOS 04 (Bestiario Sonoro): Drac de Na Coca 23 de octubre de 2025 Javier Resines
  • Karbach Brewery Rodeo Clown Double IPA (2025) 22 de octubre de 2025 Brett Stevens
  • Beats and yelling: Cultic 22 de octubre de 2025 Hate Meditations
  • Beats and yelling shorts, 20th October 25 20 de octubre de 2025 Hate Meditations
  • Karbach Brewery Hopadillo Imperial IPA (2025) 20 de octubre de 2025 Brett Stevens
  • Eureka Heights Final Boss Imperial IPA (2025) 20 de octubre de 2025 Brett Stevens
  • Tertulia con Juan Gomez, Pablo Vergel y Álvaro Martín: Spring-heeled Jack 19 de octubre de 2025 Javier Resines
  • Beats and yelling: Heruvim 17 de octubre de 2025 Hate Meditations
  • Please read the following scenario carefully 15 de octubre de 2025 Hate Meditations

Archivo

cuaderno de campo 2011-2025