0

I'm using apc to manage caching and I'm aiming to only cache the files in 4 directories:

/home/user6/public_html/beta/
/home/user6/public_html/beta/controller/
/home/user6/public_html/beta/mode/
/home/user6/public_html/beta/templates/

I have tried both of these regular expressions but neither seem to work?

apc.filters="^(?!/home/user6/public_html/beta/(|controller/|model/|templates/)).*"

apc.filters="^(?!/home/user6/public_html/beta/).*,
            "^(?!/home/user6/public_html/beta/controller/).*,
             ^(?!/home/user6/public_html/beta/model/).*,
             ^(?!/home/user6/public_html/beta/templates/).*"

Are my regular expressions wrong or is something else incorrect?

At the moment the site works through: index.php - which then includes the controller/model/template files

Only /home/user6/public_html/beta/index.php shows up as a cached file so could the issue be that other files are never seen by apc due to being included and not directly accessed?

Dan
  • 11,914
  • 14
  • 49
  • 112

1 Answers1

1

As apc.filters specifies the (list of) regexp where a match means don't filter, you are correctly using a negative assertion. However there is a simple flaw in your boolean logic, the old nots ands and ors.

Let's take the second filter rule:

  • Don't cache if the dir does not include /home/user6/public_html/beta/ or
  • Don't cache if the dir does not include /home/user6/public_html/beta/controller/ or
  • Don't cache if the dir does not include /home/user6/public_html/beta/model or
  • Don't cache if the dir does not include /home/user6/public_html/beta/templates or

Oops. A .../beta/controller/x.php matches (3) and (4) so is not cached. Etc.

If you want to do an only cache then create the match filter and flip it. You also don't want to cache anything outside of the beta tree so why not:

^(?!public_html/beta/(controller/|model/|templates/)?\w*\.php).

Which is your intent, I think.

TerryE
  • 10,724
  • 5
  • 26
  • 48
  • I've used the following: `"^(?!/home/user6/public_html/beta/(controller/|model/|templates/)?\w*\.php)."` but still no caching on included .php files, only those accessed directly. – Dan Jul 16 '12 at 14:12