@@ -111,7 +111,7 @@ static void AddOrUpdateMasterDb(TorrentDetails torrent)
111111 #endregion
112112
113113 #region OpenRead / OpenWrite
114- public static IReadOnlyDictionary < string , TorrentDetails > OpenRead ( string key , bool update_lastread = false )
114+ public static IReadOnlyDictionary < string , TorrentDetails > OpenRead ( string key , bool update_lastread = false , bool cache = true )
115115 {
116116 if ( openWriteTask . TryGetValue ( key , out WriteTaskModel val ) )
117117 {
@@ -126,7 +126,7 @@ public static IReadOnlyDictionary<string, TorrentDetails> OpenRead(string key, b
126126
127127 var fdb = new FileDB ( key ) ;
128128
129- if ( AppInit . conf . evercache . enable )
129+ if ( cache && AppInit . conf . evercache . enable )
130130 {
131131 var wtm = new WriteTaskModel ( ) { db = fdb , openconnection = 1 } ;
132132 if ( update_lastread )
@@ -141,7 +141,7 @@ public static IReadOnlyDictionary<string, TorrentDetails> OpenRead(string key, b
141141 return fdb . Database ;
142142 }
143143
144- public static FileDB OpenWrite ( string key , bool cache = true )
144+ public static FileDB OpenWrite ( string key )
145145 {
146146 if ( openWriteTask . TryGetValue ( key , out WriteTaskModel val ) )
147147 {
@@ -151,22 +151,19 @@ public static FileDB OpenWrite(string key, bool cache = true)
151151 else
152152 {
153153 var fdb = new FileDB ( key ) ;
154-
155- if ( cache )
156- openWriteTask . TryAdd ( key , new WriteTaskModel ( ) { db = fdb , openconnection = 1 } ) ;
157-
154+ openWriteTask . TryAdd ( key , new WriteTaskModel ( ) { db = fdb , openconnection = 1 } ) ;
158155 return fdb ;
159156 }
160157 }
161158 #endregion
162159
163160 #region AddOrUpdate
164- public static void AddOrUpdate ( IReadOnlyCollection < TorrentBaseDetails > torrents , bool cache = true )
161+ public static void AddOrUpdate ( IReadOnlyCollection < TorrentBaseDetails > torrents )
165162 {
166- _ = AddOrUpdate ( torrents , null , cache ) ;
163+ _ = AddOrUpdate ( torrents , null ) ;
167164 }
168165
169- async public static ValueTask AddOrUpdate < T > ( IReadOnlyCollection < T > torrents , Func < T , IReadOnlyDictionary < string , TorrentDetails > , Task < bool > > predicate , bool cache = true ) where T : TorrentBaseDetails
166+ async public static ValueTask AddOrUpdate < T > ( IReadOnlyCollection < T > torrents , Func < T , IReadOnlyDictionary < string , TorrentDetails > , Task < bool > > predicate ) where T : TorrentBaseDetails
170167 {
171168 var temp = new Dictionary < string , List < T > > ( ) ;
172169
@@ -181,7 +178,7 @@ async public static ValueTask AddOrUpdate<T>(IReadOnlyCollection<T> torrents, Fu
181178
182179 foreach ( var t in temp )
183180 {
184- using ( var fdb = OpenWrite ( t . Key , cache ) )
181+ using ( var fdb = OpenWrite ( t . Key ) )
185182 {
186183 foreach ( var torrent in t . Value )
187184 {
0 commit comments