-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dave Marshall
committed
Apr 4, 2011
0 parents
commit 9541e8a
Showing
23 changed files
with
4,540 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
RewriteEngine On | ||
|
||
# Some hosts may require you to use the `RewriteBase` directive. | ||
# If you need to use the `RewriteBase` directive, it should be the | ||
# absolute physical path to the directory that contains this htaccess file. | ||
# | ||
# RewriteBase / | ||
|
||
RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteRule ^(.*)$ index.php [QSA,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Asynchronous cache priming with progress bars via Gearman and Memcached | ||
|
||
This is a simple example application of how I'm using Gearman and Memcached to | ||
provide the user feedback by using asynchronous workers to prime caches if they | ||
are not valid | ||
|
||
See my blog post for more details at <http://www.davedevelopment.co.uk/2011/04/04/asynchronous-cache-priming-with-progress-bars-via-gearman-memcache-and-dojo> | ||
|
||
## Usage | ||
|
||
### Install Gearman and Memcached, including PECL modules | ||
<pre> | ||
> sudo su | ||
> apt-get install gearman libgearman-dev memcached | ||
> pecl install memcache | ||
> pecl install gearman-beta | ||
> echo "extension=memcache.so" > /etc/php5/conf.d/memcache.ini | ||
> echo "extension=gearman.so" > /etc/php5/conf.d/gearman.ini | ||
> /etc/init.d/apache2 restart | ||
</pre> | ||
|
||
### Install the application somewhere in the web root | ||
<pre> | ||
> cd /var/www/ | ||
> git clone https://github.com/davedevelopment/async-demo.git | ||
</pre> | ||
|
||
### Set the worker going | ||
<pre> | ||
> cd /var/www/async-demo | ||
> php worker.php | ||
</pre> | ||
|
||
### Hit the url | ||
<pre> | ||
> firefox http://localhost/async-demo/ | ||
</pre> | ||
|
||
## Slim PHP Microframework | ||
|
||
The PHP framework used in this example is availabe at <http://github.com/codeguy/Slim> | ||
|
||
Slim is released under the MIT public license. | ||
|
||
<http://www.slimframework.com/license> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* Slim - a micro PHP 5 framework | ||
* | ||
* @author Josh Lockhart | ||
* @link http://www.slimframework.com | ||
* @copyright 2011 Josh Lockhart | ||
* | ||
* MIT LICENSE | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining | ||
* a copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
/** | ||
* Pass Exception | ||
* | ||
* This Exception will cause the Router::dispatch method | ||
* to skip the current matching route and continue to the next | ||
* matching route. If no subsequent routes are found, a | ||
* HTTP 404 Not Found response will be sent to the client. | ||
* | ||
* @package Slim | ||
* @author Josh Lockhart <info@joshlockhart.com> | ||
* @since Version 1.0 | ||
*/ | ||
class Slim_Exception_Pass extends Exception {} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* Slim - a micro PHP 5 framework | ||
* | ||
* @author Josh Lockhart | ||
* @link http://www.slimframework.com | ||
* @copyright 2011 Josh Lockhart | ||
* | ||
* MIT LICENSE | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining | ||
* a copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
/** | ||
* Request Slash Exception | ||
* | ||
* This Exception is thrown when Slim detects a matching route | ||
* (defined with a trailing slash) and the HTTP request | ||
* matches the route but does not have a trailing slash. This | ||
* exception will be caught in `Slim::run` and trigger a 301 redirect | ||
* to the same resource URI with a trailing slash. | ||
* | ||
* @package Slim | ||
* @author Josh Lockhart <info@joshlockhart.com> | ||
* @since Version 1.0 | ||
*/ | ||
class Slim_Exception_RequestSlash extends Exception {} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Slim - a micro PHP 5 framework | ||
* | ||
* @author Josh Lockhart | ||
* @link http://www.slimframework.com | ||
* @copyright 2011 Josh Lockhart | ||
* | ||
* MIT LICENSE | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining | ||
* a copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
/** | ||
* Stop Exception | ||
* | ||
* This Exception is thrown when the Slim application needs to abort | ||
* processing and return control flow to the outer PHP script. | ||
* | ||
* @package Slim | ||
* @author Josh Lockhart <info@joshlockhart.com> | ||
* @since Version 1.0 | ||
*/ | ||
class Slim_Exception_Stop extends Exception {} | ||
|
||
?> |
Oops, something went wrong.