Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP caching #22

Merged
merged 9 commits into from
Sep 4, 2018
Merged

HTTP caching #22

merged 9 commits into from
Sep 4, 2018

Conversation

johanjanssens
Copy link
Member

@johanjanssens johanjanssens commented Sep 3, 2018

Implement http caching support through cacheable dispatcher behavior.

Note: It's best to read up on joomlatools/joomlatools-framework#36 to if you are not familiar with http caching

Browser Caching

See: joomlatools/joomlatools-framework#183

Server caching

Implemented a server side caching mechanism through the build in Joomla caching adapters.

Cache key

The server side cache key is based on the url, user and format, by not using the contents of the page we can return the response from cache for subsequent requests for the same resource. The longer our max-age, the longer the resource will remain valid in our server cache.

Invalidation

Using a passive cache cleanup mechanism. Files are stored on disk for max 1 week, after which they are garbage collected. This ensure that local cache is cleared for url's that are not requested, or no longer exists.

Configuration

Configuration is provided at two levels:

1. Global

Globally the cache can be configured by adding a docman.php file to the /joomla-pages root folder with the following config options:

<?php
  return array(
     'cache'         => true,
     'cache_time'    => 7200, //(seconds)
     'cache_private' => false,
);

2. Frontmatter

The cache can be disabled per page and the cache time can also be set. The frontmatter property is

process:
     cache: [true, false,  time]

The time is specified in seconds.

- Caching can be disabled through the new 'cache' page property.
- Cache time can be configured using the the 'cache_time' page property.
- Caching is disabled by default and needs to be configured through the cacheable dispatcher behavior
@johanjanssens johanjanssens self-assigned this Sep 3, 2018
@johanjanssens johanjanssens changed the title HTTP page caching HTTP caching Sep 3, 2018
@johanjanssens johanjanssens merged commit cc2ea48 into master Sep 4, 2018
@johanjanssens johanjanssens deleted the feature/21-caching branch September 4, 2018 20:39
@johanjanssens johanjanssens mentioned this pull request Sep 5, 2018
@esedic esedic mentioned this pull request Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants