This file contains hidden or 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
[mysqld] | |
sql-mode="" |
This file contains hidden or 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
<?php | |
public function getById($id) | |
{ | |
$hash = "reference:" . $id; | |
return $this->unredislizeArray($this->redis->hgetall($hash)); | |
} |
This file contains hidden or 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
<?php | |
public function unredislize($data) | |
{ | |
$data = urldecode($data); | |
// unserialize data if we can | |
$unserializedData = @unserialize($data); | |
if($unserializedData !== false) | |
{ | |
return $unserializedData; | |
} |
This file contains hidden or 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
<?php | |
public function redislize($data) | |
{ | |
// Only serialize if it's not a string or a integer | |
if(!is_string($data) && !is_integer($data)) | |
{ | |
return urlencode(serialize($data)); | |
} | |
// Encode string to escape wrong saves | |
return urlencode($data); |
This file contains hidden or 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
<?php | |
public function create(MonObjet $object) | |
{ | |
$hash = "reference:" . $object->getId(); | |
if($this->redis->exists($hash)) | |
{ | |
throw new \Exception('An redis hash "' . $hash . ' already exist'); | |
} | |
$values = $this->transformObjectToArray($object); | |
$valuesReadyToRedis = $this->redislizeArray($array); |
This file contains hidden or 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
snc_redis: | |
clients: | |
victoire: | |
type: predis | |
alias: victoire | |
dsn: redis://localhost |
This file contains hidden or 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
<?php | |
new Snc\RedisBundle\SncRedisBundle(), |