Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live stream urls cached, media item video accessibility not cached, session garbage collection now handled in cron job #824

Merged
merged 3 commits into from
Mar 17, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
MediaItemVideo: check for accessibility not cached, urls are
  • Loading branch information
tjenkinson committed Mar 17, 2016
commit b700953654c5a6e2f664e73c697314d0c2b4b3c7
18 changes: 11 additions & 7 deletions app/models/MediaItemVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,23 @@ public function getTimeRecordedForInputAttribute() {

// returns the uris to the different renders of the video
public function getQualitiesWithUris() {
$sourceFile = $this->sourceFile;

// the check to see if the item is accessible shouldn't be cached
if (is_null($sourceFile) || !$sourceFile->getShouldBeAccessible()) {
return array();
}


// cache for 10 seconds
// Urls may be different depending on the logged in (cms) user depending on the permissions the user has
// so different caches are needed per (cms) user.
// the check to make sure the item is accessible was above, so we can guarantee that the cached version (or to be cached)
// version will contain urls
$user = Auth::getUser();
$cacheKeyUserId = !is_null($user) ? intval($user->id) : -1;
return Cache::remember("mediaItemVideo.".$cacheKeyUserId.".".$this->id.".qualitiesWithUris", 10, function() {
return Cache::remember("mediaItemVideo.".$cacheKeyUserId.".".$this->id.".qualitiesWithUris", 10, function() use (&$sourceFile) {

$sourceFile = $this->sourceFile;

if (is_null($sourceFile) || !$sourceFile->getShouldBeAccessible()) {
return array();
}

$renders = $sourceFile->renderFiles;
$qualities = array();
$positions = array();
Expand Down