Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Redis Page Cache
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
WP Plugins
Redis Page Cache
Commits
a457962c
Commit
a457962c
authored
11 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
Add minification using regex from
http://jesin.tk/how-to-use-php-to-minify-html-output/
parent
e66f029e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
index-redis-page-cache.php
+9
-0
9 additions, 0 deletions
index-redis-page-cache.php
with
9 additions
and
0 deletions
index-redis-page-cache.php
+
9
−
0
View file @
a457962c
...
...
@@ -42,6 +42,7 @@ $redis_page_cache_config = array(
'cache_headers'
=>
true
,
'additional_headers'
=>
array
(
'link'
,
'x-hacker'
,
'x-pingback'
),
'query_strings_to_ignore'
=>
array
(),
// common tracking strings are automatically excluded
'minify'
=>
false
,
);
// Uncomment either option below to fix the values here and disable the admin UI
...
...
@@ -408,6 +409,14 @@ try {
'headers'
=>
array
(),
);
// Minify cached content
if
(
$redis_page_cache_config
[
'minify'
]
)
{
$search
=
array
(
'#\>[^\S ]+#s'
,
'#[^\S ]+\<#s'
,
'#(\s)+#s'
);
$replace
=
array
(
'>'
,
'<'
,
'\\1'
);
$cache
[
'output'
]
=
preg_replace
(
$search
,
$replace
,
$cache
[
'output'
]
);
}
// Capture certain headers
// Props to @andy and Batcache (http://wordpress.org/plugins/batcache/) for this code
if
(
!
empty
(
$redis_page_cache_config
[
'additional_headers'
]
)
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment