Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
composer.lock
78 changes: 1 addition & 77 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,80 +38,4 @@
* @link http://soflomo.com
*/

namespace Soflomo\Cache;

use Zend\Loader;
use Zend\ModuleManager\Feature;
use Zend\Console\Adapter\AdapterInterface as Console;

class Module implements
Feature\ConfigProviderInterface,
Feature\AutoloaderProviderInterface,
Feature\ConsoleUsageProviderInterface
{
public function getAutoloaderConfig()
{
return array(
Loader\AutoloaderFactory::STANDARD_AUTOLOADER => array(
Loader\StandardAutoloader::LOAD_NS => array(
__NAMESPACE__ => __DIR__ . '/src/Soflomo/Cache',
),
),
);
}

public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}

public function getConsoleUsage(Console $console)
{
$usage = array(
'Clear',
'cache --flush [--force|-f] [<name>]' => 'Flush complete cache',
'cache --clear [--force|-f] [<name>] --expired|-e' => 'Clear expired cache',
'cache --clear [--force|-f] [<name>] --by-namespace=' => 'Clear cache by namespace',
'cache --clear [--force|-f] [<name>] --by-prefix=' => 'Clear cache by prefix',

array('<name>', 'Optional service name of the cache'),
array('--expired|-e', 'Clear all expired items in cache'),
array('--by-namespace=', 'Clear all items in cache with given namespace'),
array('--by-prefix=', 'Clear all items in cache with given prefix'),
array('--force|-f', 'Force clearing, without asking confirmation'),

'Optimize',
'cache --optimize [<name>]' => 'Optimize cache',

array('<name>', 'Optional service name of the cache'),

'Status information',
'cache --status [<name>] [-h]' => 'Show (storage) information about the cache',

array('<name>', 'Optional service name of the cache'),
array('-h', 'Show status in human readable output'),

'Application configuration files',
'cache --clear-config' => 'Clear the merged configuration file',
'cache --clear-module-map' => 'Clear the module map',
);

if (class_exists('Doctrine\\ORM\\Configuration')) {
$usage = array_merge($usage, array(
'Doctrine cache',
'cache --clear-doctrine' => 'Flush all Doctrine caches',
'cache --clear-doctrine [--query|-q]' => 'Flush Doctrine query cache',
'cache --clear-doctrine [--result|-r]' => 'Flush Doctrine result cache',
'cache --clear-doctrine [--metadata|-m]' => 'Flush Doctrine metadata cache',
'cache --clear-doctrine [--hydration|-h]' => 'Flush Doctrine hydration cache',

array('--query|-q', 'Clear only Doctrine query cache'),
array('--result|-r', 'Clear only Doctrine result cache'),
array('--metadata|-m', 'Clear only Doctrine metadata cache'),
array('--hydration|-h', 'Clear only Doctrine hydration cache'),
));
}

return $usage;
}
}
require_once __DIR__ . '/src/Module.php';
25 changes: 16 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,23 @@
}
],
"require": {
"php": ">=5.3.3",
"zendframework/zend-cache": "~2.0",
"zendframework/zend-mvc": "~2.0"
"php": "^5.5 || ^7.0",
"zendframework/zend-cache": "^2.0",
"zendframework/zend-mvc": "^2.0 || ^3.0",
"zendframework/zend-modulemanager": "^2.0",
"zendframework/zend-console": "^2.0",
"zendframework/zend-servicemanager": "^2.7 || ^3.0",
"container-interop/container-interop": "^1.0"
},
"require-dev": {
"doctrine/doctrine-orm-module": "~0.9 || ^1.0"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add also into suggest

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snapshotpl Done. Thank you

},
"suggest": {
"doctrine/doctrine-orm-module": "Install it to be able to clear doctrine cache"
},
"autoload": {
"psr-0": {
"Soflomo\\Cache": "src/"
},
"classmap": [
"./Module.php"
]
"psr-4": {
"Soflomo\\Cache\\": "src/"
}
}
}
Loading