Skip to content

Latest commit

 

History

History
56 lines (45 loc) · 941 Bytes

redis.md

File metadata and controls

56 lines (45 loc) · 941 Bytes

Redis

Install Dependency

  • Install EXT-Redis
php laragram get:redis
  • Remove EXT-Redis
php laragram remove:redis

⚙️ Usage

// init Redis Server
$redis = PhpRedis::connect();

// set
$redis->set($key, $value);
$redis->set('foo', 'bar');

//get
$data = $redis->get($key));
$data = $redis->get('foo'));

// The rest of the methods are the same as the php redis client
  • Pass Db name:
// init Redis Server with db name
$redis = PhpRedis::connect('dbname');

ENV Variable

# Redis server ip
REDIS_IP=127.0.0.1

# Redis server port
REDIS_PORT=6379

# Redis server username
REDIS_USER=

# Redis server password
REDIS_PASS=

# Redis server database name
REDIS_DB=9000