Adding REAMDEs to directories

This commit is contained in:
Philipp Holzer 2019-03-03 15:05:35 +01:00 committed by Hypolite Petovan
parent 3261ffbd99
commit 8237e73e26
9 changed files with 48 additions and 7 deletions

View file

@ -4,7 +4,7 @@
*/
namespace Friendica\Core;
use Friendica\Core\Cache\CacheDriverFactory;
use Friendica\Factory\CacheDriverFactory;
/**
* @brief Class for storing data for a short time

View file

@ -1,48 +0,0 @@
<?php
namespace Friendica\Core\Cache;
use Friendica\Core\Config;
/**
* Class CacheDriverFactory
*
* @package Friendica\Core\Cache
*
* A basic class to generate a CacheDriver
*/
class CacheDriverFactory
{
/**
* This method creates a CacheDriver for the given cache driver name
*
* @param string $driver The name of the cache driver
* @return ICacheDriver The instance of the CacheDriver
* @throws \Exception The exception if something went wrong during the CacheDriver creation
*/
public static function create($driver) {
switch ($driver) {
case 'memcache':
$memcache_host = Config::get('system', 'memcache_host');
$memcache_port = Config::get('system', 'memcache_port');
return new MemcacheCacheDriver($memcache_host, $memcache_port);
break;
case 'memcached':
$memcached_hosts = Config::get('system', 'memcached_hosts');
return new MemcachedCacheDriver($memcached_hosts);
break;
case 'redis':
$redis_host = Config::get('system', 'redis_host');
$redis_port = Config::get('system', 'redis_port');
return new RedisCacheDriver($redis_host, $redis_port);
break;
default:
return new DatabaseCacheDriver();
}
}
}

View file

@ -7,7 +7,7 @@
namespace Friendica\Core;
use Friendica\Core\Cache\CacheDriverFactory;
use Friendica\Factory\CacheDriverFactory;
use Friendica\Core\Cache\IMemoryCacheDriver;
/**

4
src/Core/README.md Normal file
View file

@ -0,0 +1,4 @@
## Friendica\Core
The Core namespace contains classes, which are essential to Friendica.