Once they've finished airing, it's more unlikely they'll get updates. We
only consider they as finished if they were cached more than one
AnimeCacheDuration after the end though.
if a == nil {
return true
}
+ now := time.Now()
+ diff := now.Sub(a.Cached)
if a.Incomplete {
- return time.Now().Sub(a.Cached) > AnimeIncompleteCacheDuration
+ return diff > AnimeIncompleteCacheDuration
}
- return time.Now().Sub(a.Cached) > AnimeCacheDuration
+
+ // If the anime ended, and more than AnimeCacheDuration time ago at that
+ if !a.EndDate.IsZero() && now.After(a.EndDate.Add(AnimeCacheDuration)) {
+ return diff > FinishedAnimeCacheDuration
+ }
+ return diff > AnimeCacheDuration
}
// Unique Anime IDentifier.
GroupCacheDuration = 4 * DefaultCacheDuration // They don't change that often.
FileCacheDuration = 8 * DefaultCacheDuration // These change even less often.
+ // Used for anime that have already finished airing.
+ // It's unlikely that they get any important updates.
+ FinishedAnimeCacheDuration = 4 * AnimeCacheDuration
+
// Used when a request uses a non-existing key (AID, ed2k+size, etc)
InvalidKeyCacheDuration = 1 * time.Hour