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

Improve page and data registry cache #43

Merged
merged 15 commits into from
Jan 9, 2019
Merged

Conversation

johanjanssens
Copy link
Member

@johanjanssens johanjanssens commented Jan 8, 2019

This PR refactors the page and data cache.

Page registry cache

The page registry cache is stored in a single file, prefixed with 'page_'. The file contains the files structure and the file metadata as a php array. The actual content of the file is not cached.

  • Added an additional ComPagesPageRegistry::buildCache() method to programmatically build the cache, for example during a deploy.

  • Added a ComPagesPageRegistry::cache_time config option to allow defining the cache expiration time in seconds, default 606024 or 1 day.

Data cache

The data registry cache stores a file per root data folder, prefixed with 'data_'. The file contains the data as a php array.

  • Added an additional ComPagesDataRegistry::buildCache() method to programmatically build the cache, for example during a deploy.

  • Added a ComPagesDataRegistry::cache_time config option to allow defining the cache expiration time in seconds, default 606024 or 1 day.

Configuration

Added following config options:

page_cache: JDEBUG ? false : true
page_cache_time: 60*60*24 //1d
page_cache_path: /joomlatools-pages/cache

data_cache: JDEBUG ? false : true
data_cache_time: 60*60*24, //1d
data_cache_path: /joomlatools-pages/cache

template_cache: JDEBUG ? false : true
template_cache_path: JPATH_ADMINISTRATOR.'/cache/koowa.templates'

Renamed cache and cache_time options to:

http_cache: false
http_cache_time: 7200
http_cache_path: /joomlatools-pages/cache

Notes:

  • This PR also includes a change in the way data works. If a data file has the same name as the folder it's part of, the file will not result in an additional level in the data collection. If the file has a different name the key of the level will be the name of the file

  • This issue also adds an additional ComPagesDataObject::flatten() method which is capable of flatting the first level of a data object.

  • This PR also refactors the http cache to use a custom file cache and no longer make use of the Joomla JCache API. This offers additional performance benefits as http cache objects are now also automatically stored in opcode cache.

- Add loadCache() method to allow just in time loading and refreshing of the cache
- Add buildCache() method to allow rebuilding the complete cache on demand
- Improve implementation for performance by only storing a cache file per root folder not per file
- Add cache_time config option to allow defining the cache expiration time in seconds
- Add loadCache() method to allow just in time loading and refreshing of the cache
- Add buildCache() method to allow rebuilding the complete cache on demand
- Improve implementation for performance by only storing the cache in one file
- Add cache_time config option to allow defining the cache expiration time in seconds
@johanjanssens johanjanssens added this to the 0.5.0 milestone Jan 8, 2019
@johanjanssens johanjanssens self-assigned this Jan 8, 2019
@johanjanssens johanjanssens merged commit f2e3937 into master Jan 9, 2019
@johanjanssens johanjanssens deleted the feature/42-caching branch January 9, 2019 00:24
@johanjanssens johanjanssens mentioned this pull request Jan 15, 2019
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

1 participant