From bf9787ac517fe19af5fd6ba918a66b220fcbc923 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 11 Jan 2022 18:21:04 +0000 Subject: deduplicate and freeze pathnames + metadata This ought to save some memory for dtas-player and dtas-readahead users with multiple instances of the same track(s) on their track list. --- lib/dtas/mcache.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/dtas/mcache.rb') diff --git a/lib/dtas/mcache.rb b/lib/dtas/mcache.rb index 817bfb8..4f1e9e8 100644 --- a/lib/dtas/mcache.rb +++ b/lib/dtas/mcache.rb @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2020 all contributors +# Copyright (C) all contributors # License: GPL-3.0+ # frozen_string_literal: true # encoding: binary @@ -22,7 +22,7 @@ class DTAS::Mcache @tbl[bucket] = begin cur = cur ? cur.clear : {} if ret = yield(infile, cur) - ret[:infile] = infile.frozen? ? infile : infile.dup.freeze + ret[:infile] = infile.frozen? ? infile : -(infile.dup) ret[:btime] = DTAS.now end ret -- cgit v1.2.3-24-ge0c7