WebSharks/Quick-Cache — pull request #82 by JasWSInc (2014-04-04 11:33:54+00:00)
Title: Branched Cache Structure

This pull request implements a branched cache structure in Quick Cache that came about as a result of work by @raamdev and @jaswsinc. There is another pull request for Quick Cache Pro that will get this working in the pro version too.

@raamdev I left you several comments on Floobits as I finished working through this. See: http://wsharks.com/1lu3Ew5

With this new branched cache structure it should now be possible for Quick Cache to better deal with tags/categories/comments; pagination, etc, etc. I'm sure there are some other things we can do to improve the codebase now that we a branched structure. Among other things, a static site generator could be on the horizon. In the short term, things like purging tags/cateogories/etc will be easier to deal with.

NOTE: This release also resolves an issue in QC where it was not purging multiple paginated pages of a Post/Page (or comments). Fixed with this update!

NOTE: Testing Quick Cache should be easier now... since the cache is branched (i.e. based on the URL). So it will be simpler to run tests against Quick Cache now that we have this.

Helps to resolve WebSharks/Quick-Cache#3

The basic structure looks like this in pseudo code.

```
e.g. /wp-content/cache/http/domain
e.g. /wp-content/cache/http/domain/path
e.g. /wp-content/cache/http/domain/path.q/md5(query)
e.g. /wp-content/cache/https/domain/path.q/md5(query).u/[user token]
e.g. /wp-content/cache/https/domain/path.q/md5(query).u/[user token].v/[version salt]
e.g. /wp-content/cache/https/domain/path.u/[user token]
e.g. /wp-content/cache/https/domain/path.v/[version salt]
e.g. /wp-content/cache/https/domain.u/[user token]
e.g. /wp-content/cache/https/domain.q/md5(query)
```

To understand the way this branched structure works, please check the `url_to_cache_path()` method in the base class for Quick Cache. This single method defines the cache structure.

----

Initial tests complete. That said, more testing needs to be done before a release IMO. Just to help catch anything we might have missed. Seems to working well so far though.