public function getAllEventsAsJson()
    {
        $cache = $this->cache;

        if ($cache::has(self::ALL_EVENTS_TO_JSON_KEY)) {
            return $cache::get(self::ALL_EVENTS_TO_JSON_KEY);
        }

        $allEvents = $this->calendarEventsEngine
            ->formatEventsToJson($this->getAllEvents());
        $allEventsToJson = json_encode($allEvents);
        $cache::put(self::ALL_EVENTS_TO_JSON_KEY, $allEventsToJson, $this->cacheTimeToLive);

        return $allEventsToJson;

    }