@@ -18,15 +18,17 @@ public function __construct(int $id){
1818 * Tell the system, that a user visits the episode list of this podcast
1919 * @param id the podcast id
2020 */
21- public function searchItem (int $ id ) : void {
21+ public function searchItem (int $ id, string $ noturl = '' ) : void {
2222 if ( $ this ->redis ->keyExists ( $ id . '-started ' ) ){
2323 $ url = $ this ->redis ->get ( $ id . '-started ' );
24- $ this ->redis ->remove ( $ id . '- ' . $ url );
25- $ this ->redis ->remove ( $ id . '-started ' );
26- if ( $ this ->redis ->keyExists ( 'started ' ) ){
27- $ this ->redis ->remove ( 'started ' );
24+ if ( empty ($ noturl ) || $ url !== $ noturl ){
25+ $ this ->redis ->remove ( $ id . '- ' . $ url );
26+ $ this ->redis ->remove ( $ id . '-started ' );
27+ if ( $ this ->redis ->keyExists ( 'started ' ) ){
28+ $ this ->redis ->remove ( 'started ' );
29+ }
30+ $ this ->dontRemove = true ;
2831 }
29- $ this ->dontRemove = true ;
3032 }
3133 }
3234
@@ -45,6 +47,7 @@ public function knownItem(int $id, string $url) : string {
4547 * @param eid the episode id
4648 */
4749 public function openItem (int $ id , string $ url ){
50+ $ this ->searchItem ($ id , $ url );
4851 if ( !$ this ->redis ->keyExists ( $ id . '- ' . $ url ) ){
4952 $ this ->redis ->set ( $ id . '- ' . $ url , 'S ' ); // Started
5053 $ this ->redis ->set ( $ id . '-started ' , $ url , 120 );
0 commit comments