Skip to content

Commit 84b039e

Browse files
committed
Un-/Read optim.
1 parent d308892 commit 84b039e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
latest
2-
2.2.2
2+
2.2.3
33
2.2
44
2

php/classes/UnRead.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)