Ejemplo n.º 1
0
 public function store($user, Request $request)
 {
     $meta = $this->prepareMeta($request);
     // No need to store the full Carbon object
     $meta['date'] = $meta['date']->toDateTimeString();
     $this->storage->set('usr.' . $user->getKey() . '.lastSeen', json_encode($meta, JSON_FORCE_OBJECT));
 }
Ejemplo n.º 2
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->infoStart('Getting official skin list...');
     $skins = $this->getOfficialSkinList();
     $this->infoFinish('Getting official skin done');
     $this->infoStart('Resolving skin ids to items...');
     $skins = $this->resolveSkinsToItems($skins);
     $this->infoFinish('Resolving skin ids to items done');
     Redis::set(self::$key, serialize($skins));
 }
Ejemplo n.º 3
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->infoStart('Parsing EU leaderboard...');
     $eu_rankings = $this->parseLeaderboard('eu');
     $this->infoFinish('Done parsing!');
     $this->infoStart('Parsing NA leaderboard...');
     $na_rankings = $this->parseLeaderboard('na');
     $this->infoFinish('Done parsing!');
     Redis::set(self::$key, serialize(['eu' => $eu_rankings, 'na' => $na_rankings]));
     // Trigger an event for post-processor to hook into
     Event::fire(new PvpLeaderboardUpdated());
 }
Ejemplo n.º 4
0
 /**
  * Update timestamp.
  *
  * @param  string $cached_at
  * @return bool
  */
 public function update($cached_at)
 {
     return Timestamp::set('registry_updated_at', $cached_at);
 }
Ejemplo n.º 5
0
 /**
  * @return mixed
  */
 public function destroy()
 {
     // Disable access
     if (Auth::user()->isLaunchController()) {
         Auth::user()->launch_controller_flag = false;
         Auth::user()->save();
     }
     // Turn off SpaceXStats Live
     Redis::set('live:active', false);
     // Clean up all spacexstats live redis keys
     Redis::del(['live:streams', 'live:title', 'live:description', 'live:resources', 'live:sections', 'live:updates', 'live:countdown', 'live:discussion', 'live:isForLaunch', 'live:cannedResponses', 'live:reddit', 'live:status']);
     // Send out event
     event(new LiveEndedEvent());
     return response()->json(null, 204);
 }
Ejemplo n.º 6
0
 public static function setConnection($conn)
 {
     Redis::set('mysql_current_connection', $conn);
 }
Ejemplo n.º 7
0
 public function redisPut()
 {
     Redis::set('name', 'I am wangguoying');
 }
Ejemplo n.º 8
0
 public function provision(Request $request, $id, $uuid)
 {
     $provision = \App\Provision::where('id', $id)->where('uuid', $uuid)->first();
     if ($provision === null) {
         $request->session()->flash(str_random(4), ['type' => 'danger', 'message' => 'Could not find id/uuid combo']);
         return redirect('/?ohno');
     }
     $redisKey = config('rediskeys.digitalocean_token') . $uuid;
     Redis::set($redisKey, $request->session()->get('digitalocean')['token']);
     // This expire is a backup in case the provision job fails, and doesn't delete the key explicitly at the end
     Redis::expire($redisKey, 60 * 60);
     // 60 minutes - if a provision job takes longer than this we won't be able to delete our SSH keys from the users DO account
     $provision->inputs = $request->session()->get("inputs.{$uuid}");
     // It doesn't accept SSH connections immediately after creation, so we delay
     $job = (new \App\Jobs\Provision($provision))->delay(5);
     $this->dispatch($job);
     return redirect(url('/provision/provisioning/' . $provision->id . '/' . $provision->uuid));
 }
Ejemplo n.º 9
0
 private static function requestCache()
 {
     $ads = self::where(['is_active' => 1])->select('copy', 'url_shorten as url')->orderBy('created_at', 'desc')->get()->toArray();
     $cache_key = self::getCacheKey();
     if (!empty($ads)) {
         Redis::set($cache_key, serialize($ads));
     } else {
         Redis::del($cache_key);
     }
 }