1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.6.3.1'

This commit is contained in:
gnosygnu
2016-06-19 23:58:10 -04:00
parent 96636f3161
commit d4e8590345
1960 changed files with 20790 additions and 9272 deletions

View File

@@ -29,10 +29,10 @@ public class Xow_cache_mgr {
public Xow_page_cache Page_cache() {return page_cache;} private Xow_page_cache page_cache;
public Xow_defn_cache Defn_cache() {return defn_cache;} private Xow_defn_cache defn_cache;
public Xow_defn_cache Lst_cache() {return lst_cache;} private Xow_defn_cache lst_cache;
public Hash_adp Misc_cache() {return misc_cache;} private final Hash_adp misc_cache = Hash_adp_.new_();
public Hash_adp Misc_cache() {return misc_cache;} private final Hash_adp misc_cache = Hash_adp_.New();
public Keyval[] Scrib_lang_names() {
if (scrib_lang_names == null) {
List_adp list = List_adp_.new_();
List_adp list = List_adp_.New();
Xoa_sitelink_itm_mgr itm_mgr = wiki.App().Xwiki_mgr__sitelink_mgr().Itm_mgr();
int len = itm_mgr.Len();
for (int i = 0; i < len; ++i) {

View File

@@ -22,7 +22,7 @@ import gplx.xowa.wikis.nss.*;
import gplx.xowa.parsers.tmpls.*;
public class Xow_defn_cache { // stores compiled Xot_defn
private Xol_lang_itm lang; // needed to lowercase names;
private Bry_bfr upper_1st_bfr = Bry_bfr.reset_(255);
private Bry_bfr upper_1st_bfr = Bry_bfr_.Reset(255);
private Gfo_cache_mgr cache = new Gfo_cache_mgr().Max_size_(64 * 1024 * 1024).Reduce_by_(32 * 1024 * 1024);
public Xow_defn_cache(Xol_lang_itm lang) {this.lang = lang;}
public Xot_defn Get_by_key(byte[] name) {return (Xot_defn)cache.Get_by_key(name);}

View File

@@ -28,7 +28,7 @@ public class Xow_page_cache {
byte[] ttl_full_db = ttl.Full_db();
Xow_page_cache_itm rv = (Xow_page_cache_itm)cache.Get_by_bry(ttl_full_db);
if (rv == null) {
Xoae_page page = wiki.Data_mgr().Get_page(ttl, true); // NOTE: do not call Db_mgr.Load_page; need to handle redirects
Xoae_page page = wiki.Data_mgr().Load_page_by_ttl(ttl); // NOTE: do not call Db_mgr.Load_page; need to handle redirects
if (!page.Missing()) {
rv = new Xow_page_cache_itm(page.Ttl(), page.Data_raw(), page.Redirected_src());
cache.Add_bry_obj(ttl_full_db, rv);
@@ -36,5 +36,18 @@ public class Xow_page_cache {
}
return rv;
}
public Xow_page_cache_itm Get_or_load_as_itm_2(Xoa_ttl ttl) { // NOTE: same as Get_or_load_as_itm, but handles redirects to missing pages; DATE:2016-05-02
byte[] ttl_full_db = ttl.Full_db();
Xow_page_cache_itm rv = (Xow_page_cache_itm)cache.Get_by_bry(ttl_full_db);
if (rv == null) {
Xoae_page page = wiki.Data_mgr().Load_page_by_ttl(ttl); // NOTE: do not call Db_mgr.Load_page; need to handle redirects
if ( !page.Missing() // page exists
|| page.Redirected_src() != null) { // page redirects to missing page; note that page.Missing == true and page.Redirected_src() != null; PAGE: en.w:Shah_Rukh_Khan; DATE:2016-05-02
rv = new Xow_page_cache_itm(page.Ttl(), page.Data_raw(), page.Redirected_src());
cache.Add_bry_obj(ttl_full_db, rv);
}
}
return rv;
}
public void Free_mem_all() {cache.Clear();}
}