| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -66,9 +66,7 @@ public function put($key, $value, $minutes) | |||
| 66 | 66 | { | |
| 67 | 67 | $value = is_numeric($value) ? $value : serialize($value); | |
| 68 | 68 | ||
| 69 | - $this->connection()->set($this->prefix.$key, $value); | ||
| 70 | - | ||
| 71 | - $this->connection()->expire($this->prefix.$key, $minutes * 60); | ||
| 69 | + $this->connection()->setex($this->prefix.$key, $minutes * 60, $value); | ||
| 72 | 70 | } | |
| 73 | 71 | ||
| 74 | 72 | /** | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,19 +40,17 @@ public function testRedisValueIsReturnedForNumerics() | |||
| 40 | 40 | public function testSetMethodProperlyCallsRedis() | |
| 41 | 41 | { | |
| 42 | 42 | $redis = $this->getRedis(); | |
| 43 | - $redis->getRedis()->shouldReceive('connection')->twice()->with('default')->andReturn($redis->getRedis()); | ||
| 44 | - $redis->getRedis()->shouldReceive('set')->once()->with('prefix:foo', serialize('foo')); | ||
| 45 | - $redis->getRedis()->shouldReceive('expire')->once()->with('prefix:foo', 60 * 60); | ||
| 43 | + $redis->getRedis()->shouldReceive('connection')->once()->with('default')->andReturn($redis->getRedis()); | ||
| 44 | + $redis->getRedis()->shouldReceive('setex')->once()->with('prefix:foo', 60 * 60, serialize('foo')); | ||
| 46 | 45 | $redis->put('foo', 'foo', 60); | |
| 47 | 46 | } | |
| 48 | 47 | ||
| 49 | 48 | ||
| 50 | 49 | public function testSetMethodProperlyCallsRedisForNumerics() | |
| 51 | 50 | { | |
| 52 | 51 | $redis = $this->getRedis(); | |
| 53 | - $redis->getRedis()->shouldReceive('connection')->twice()->with('default')->andReturn($redis->getRedis()); | ||
| 54 | - $redis->getRedis()->shouldReceive('set')->once()->with('prefix:foo', 1); | ||
| 55 | - $redis->getRedis()->shouldReceive('expire')->once()->with('prefix:foo', 60 * 60); | ||
| 52 | + $redis->getRedis()->shouldReceive('connection')->once()->with('default')->andReturn($redis->getRedis()); | ||
| 53 | + $redis->getRedis()->shouldReceive('setex')->once()->with('prefix:foo', 60 * 60, 1); | ||
| 56 | 54 | $redis->put('foo', 1, 60); | |
| 57 | 55 | } | |
| 58 | 56 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments