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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"require": {
"php": ">=5.4.0",

"elogank/lol-replay-downloader": "1.1.*@dev",
"elogank/lol-replay-downloader": "1.2.x-dev",

"psr/log": "~1.0"
},
Expand All @@ -31,4 +31,4 @@
"": "src/"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/*
* This file is part of the "EloGank League of Legends Replay Observer" package.
*
* https://github.com/EloGank/lol-replay-observer
*
* For the full license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace NEloGank\Replay\Observer\Cache\Adapter;

/**
* @author Sylvain Lorinet <sylvain.lorinet@gmail.com>
*/
interface CacheAdapterInterface
{
/**
* @param string $key The cache key
*
* @return bool True if the key exists and is not expired
*/
public function has($key);

/**
* @param string $key The cache key
*
* @return mixed The value for the selected key
*/
public function get($key);

/**
* @param string $key The cache key
* @param mixed $value The value
* @param null|int $ttl The time to live in second, must be greater than zero. Let NULL if no expiration.
*
* @return bool
*/
public function set($key, $value, $ttl = null);
}
76 changes: 76 additions & 0 deletions src/NEloGank/Replay/Observer/Cache/Adapter/RedisCacheAdapter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

/*
* This file is part of the "EloGank League of Legends Replay Observer" package.
*
* https://github.com/EloGank/lol-replay-observer
*
* For the full license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace NEloGank\Replay\Observer\Cache\Adapter;

/**
* @author Sylvain Lorinet <sylvain.lorinet@gmail.com>
*/
class RedisCacheAdapter implements CacheAdapterInterface
{
/**
* @var mixed
*/
protected $redis;


/**
* @param mixed $redis
*/
public function __construct($redis)
{
$this->redis = $redis;
}

/**
* @param string $key The cache key
*
* @return bool True if the key exists and is not expired
*/
public function has($key)
{
return $this->redis->exists($key);
}

/**
* @param string $key The cache key
*
* @return mixed The value for the selected key
*/
public function get($key)
{
return $this->redis->get($key);
}

/**
* @param string $key The cache key
* @param mixed $value The value
* @param null|int $ttl The time to live in second, must be greater than zero. Let NULL if no expiration.
*
* @return bool
*/
public function set($key, $value, $ttl = null)
{
if (null == $ttl) {
return $this->redis->set($key, $value);
}

if (null == $ttl) {
return $this->redis->set($key, $value);
}

if (!is_int($ttl) || 0 >= $ttl) {
throw new \InvalidArgumentException('The time to live parameter must be an integer and greater than zero.');
}

return $this->redis->setex($key, $ttl, $value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/*
* This file is part of the "EloGank League of Legends Replay Observer" package.
*
* https://github.com/EloGank/lol-replay-observer
*
* For the full license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace NEloGank\Replay\Observer\Client\Exception;

use NEloGank\Replay\Exception\ReplayException;

/**
* @author Sylvain Lorinet <sylvain.lorinet@gmail.com>
*/
class ReplayChunkNotFoundException extends ReplayException { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/*
* This file is part of the "EloGank League of Legends Replay Observer" package.
*
* https://github.com/EloGank/lol-replay-observer
*
* For the full license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace NEloGank\Replay\Observer\Client\Exception;

use NEloGank\Replay\Exception\ReplayException;

/**
* @author Sylvain Lorinet <sylvain.lorinet@gmail.com>
*/
class ReplayEndStatsNotFoundException extends ReplayException { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/*
* This file is part of the "EloGank League of Legends Replay Observer" package.
*
* https://github.com/EloGank/lol-replay-observer
*
* For the full license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace NEloGank\Replay\Observer\Client\Exception;

use NEloGank\Replay\Exception\ReplayException;

/**
* @author Sylvain Lorinet <sylvain.lorinet@gmail.com>
*/
class ReplayFolderNotFoundException extends ReplayException { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/*
* This file is part of the "EloGank League of Legends Replay Observer" package.
*
* https://github.com/EloGank/lol-replay-observer
*
* For the full license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace NEloGank\Replay\Observer\Client\Exception;

use NEloGank\Replay\Exception\ReplayException;

/**
* @author Sylvain Lorinet <sylvain.lorinet@gmail.com>
*/
class ReplayKeyframeNotFoundException extends ReplayException { }
Loading