From 425ec918ae83419990a9f18f7e85d78c9f913e5b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 10 Jun 2019 20:10:57 -0600 Subject: [PATCH] Add StatusService --- app/Services/StatusService.php | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 app/Services/StatusService.php diff --git a/app/Services/StatusService.php b/app/Services/StatusService.php new file mode 100644 index 00000000..289fcdf8 --- /dev/null +++ b/app/Services/StatusService.php @@ -0,0 +1,46 @@ +setSerializer(new ArraySerializer()); + $resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer()); + $res = $fractal->createData($resource)->toJson(); + self::set($id, $res); + return $res; + } + + public static function set($key, $val) + { + return Redis::set(self::CACHE_KEY . $key, $val); + } + + public static function del($key) + { + return Redis::del(self::CACHE_KEY . $key); + } + + public static function rem($key) + { + return self::del($key); + } +} \ No newline at end of file