https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32894

Jonathan Druart <jonathan.druart+k...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #150847|0                           |1
        is obsolete|                            |
 Attachment #150848|0                           |1
        is obsolete|                            |
 Attachment #150849|0                           |1
        is obsolete|                            |
 Attachment #150850|0                           |1
        is obsolete|                            |
 Attachment #150851|0                           |1
        is obsolete|                            |
 Attachment #150852|0                           |1
        is obsolete|                            |
 Attachment #150853|0                           |1
        is obsolete|                            |
 Attachment #150854|0                           |1
        is obsolete|                            |
 Attachment #150855|0                           |1
        is obsolete|                            |

--- Comment #37 from Jonathan Druart <jonathan.druart+k...@gmail.com> ---
Created attachment 152086
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=152086&action=edit
Bug 32894: Remove wrong caching from Koha:: methods - simple

In some of our Koha:: objects we have methods that cache their result and
return it in subsequent calls. However there is no invalidation of the cache if
the object is modified.

For instance, in Koha/ArticleRequest.pm

sub biblio {
    my ($self) = @_;

    $self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() );

    return $self->{_biblio};
}

This pattern exists in several places.

It can lead to confusion and incorrect results, such as:

use Koha::ArticleRequests;
my $ar = Koha::ArticleRequest->new({
    borrowernumber => 42,
    biblionumber => 42,
})->store;
say $ar->biblio->biblionumber;               # Display 42, correct
$ar->set({ biblionumber => 24 })->store;
say $ar->biblio->biblionumber;               # Display 42, wrong
$ar->discard_changes;
say $ar->biblio->biblionumber;               # Display 42, wrong
$ar->delete;

We should remove those caching and rely on DBIC/DBMS caching mechanism instead.

This patch is adjusting the trivial occurrences

Signed-off-by: Martin Renvoize <martin.renvo...@ptfs-europe.com>
Signed-off-by: Nick Clemens <n...@bywatersolutions.com>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to