Skip to content

Commit

Permalink
Update documentation and minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitpokhrel committed Dec 2, 2019
1 parent 4498ca5 commit da4e4d7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ to pause, or by accident in case of a network issue or server outage.
Pull the package via composer.
```shell
$ composer require ankitpokhrel/tus-php

// Use symfony-5 branch for Symfony 5+

$ composer require ankitpokhrel/tus-php:dev-symfony-5
```

### Usage
Expand All @@ -78,7 +82,7 @@ This is how a simple server looks like.
```php
// server.php

$server = new \TusPhp\Tus\Server('redis'); // Leave empty for file based cache
$server = new \TusPhp\Tus\Server('redis'); // Either redis, file or apcu. Leave empty for file based cache.
$response = $server->serve();

$response->send();
Expand Down Expand Up @@ -249,7 +253,7 @@ Usage:
tus:expired [<cache-adapter>] [options]

Arguments:
cache-adapter Cache adapter to use, redis or file. Optional, defaults to file based cache. [default: "file"]
cache-adapter Cache adapter to use: redis, file or apcu [default: "file"]

Options:
-c, --config=CONFIG File to get config parameters from.
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"symfony/http-foundation": "^3.4.11 || ^4.0"
},
"require-dev": {
"ext-apcu": "*",
"ext-pcntl": "*",
"friendsofphp/php-cs-fixer": "^2.9",
"mockery/mockery": "^1.3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Cache/ApcuStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class ApcuStore extends AbstractCache
{

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -58,6 +57,7 @@ public function delete(string $key): bool
public function keys(): array
{
$iterator = new APCUIterator('/^' . preg_quote($this->getPrefix()) . '.*$/', APC_ITER_KEY);

return array_column(iterator_to_array($iterator, false), 'key');
}

Expand Down
4 changes: 2 additions & 2 deletions src/Commands/ExpirationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ protected function configure()
$this
->setName('tus:expired')
->setDescription('Remove expired uploads.')
->setHelp('Deletes all expired uploads to free server resources. Values can be redis or file. Defaults to file.')
->setHelp('Deletes all expired uploads to free server resources. Values can be redis, file or apcu. Defaults to file.')
->addArgument(
'cache-adapter',
InputArgument::OPTIONAL,
'Cache adapter to use, redis or file. Optional, defaults to file based cache.',
'Cache adapter to use: redis, file or apcu',
'file'
)
->addOption(
Expand Down
5 changes: 2 additions & 3 deletions tests/Cache/ApcuStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace TusPhp\Test\Cache;

use Exception;
use TusPhp\Cache\ApcuStore;
use PHPUnit\Framework\TestCase;

Expand All @@ -11,13 +10,13 @@
*/
class ApcuStoreTest extends TestCase
{

/** @var boolean */
protected static $extensionLoaded;

/** @var ApcuStore */
protected static $store;


/** @var string */
protected $checksum = '74f02d6da32082463e382f2274e85fd8eae3e81f739f8959abc91865656e3b3a';

/**
Expand Down

0 comments on commit da4e4d7

Please sign in to comment.