<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.terramonmod.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ATr%2Floaddata</id>
	<title>Module:Tr/loaddata - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.terramonmod.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ATr%2Floaddata"/>
	<link rel="alternate" type="text/html" href="https://wiki.terramonmod.com/index.php?title=Module:Tr/loaddata&amp;action=history"/>
	<updated>2026-07-13T06:18:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.terramonmod.com/index.php?title=Module:Tr/loaddata&amp;diff=21&amp;oldid=prev</id>
		<title>JamzOJamz: Created page with &quot;-- Note:  -- It seems that objects/lists stored via luacache have a limit on the number of entities,  which is about 8k. -- Any object/list which has more then 8k entities or having such a large sub-object/sub-list will be truncated. -- Therefore, we encode the data into a string to get around this problem.  local cache = mw.ext.LuaCache  return { 	 	load = function(lang) 		local status, result = pcall(function () 			return mw.text.jsonDecode(cache.get(&#039;tr__database-&#039;..l...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.terramonmod.com/index.php?title=Module:Tr/loaddata&amp;diff=21&amp;oldid=prev"/>
		<updated>2025-11-23T20:05:08Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;-- Note:  -- It seems that objects/lists stored via luacache have a limit on the number of entities,  which is about 8k. -- Any object/list which has more then 8k entities or having such a large sub-object/sub-list will be truncated. -- Therefore, we encode the data into a string to get around this problem.  local cache = mw.ext.LuaCache  return { 	 	load = function(lang) 		local status, result = pcall(function () 			return mw.text.jsonDecode(cache.get(&amp;#039;tr__database-&amp;#039;..l...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Note: &lt;br /&gt;
-- It seems that objects/lists stored via luacache have a limit on the number of entities,  which is about 8k.&lt;br /&gt;
-- Any object/list which has more then 8k entities or having such a large sub-object/sub-list will be truncated.&lt;br /&gt;
-- Therefore, we encode the data into a string to get around this problem.&lt;br /&gt;
&lt;br /&gt;
local cache = mw.ext.LuaCache&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	&lt;br /&gt;
	load = function(lang)&lt;br /&gt;
		local status, result = pcall(function ()&lt;br /&gt;
			return mw.text.jsonDecode(cache.get(&amp;#039;tr__database-&amp;#039;..lang))&lt;br /&gt;
		end)&lt;br /&gt;
		if status then&lt;br /&gt;
			return result&lt;br /&gt;
		else&lt;br /&gt;
			-- fallback&lt;br /&gt;
			local info = require(&amp;#039;Module:Tr/db-&amp;#039;..lang) -- return table of mw.loadData() has a metatable, can not be used for cache.set and mw.loadData.&lt;br /&gt;
			&lt;br /&gt;
			-- add on wiki language list&lt;br /&gt;
			info.onWikiLangList = { [&amp;#039;ko&amp;#039;] = true }&lt;br /&gt;
			&lt;br /&gt;
			-- cache it. &lt;br /&gt;
			-- This cache can be purged by:&lt;br /&gt;
			-- * purge Module:tr/db-&amp;lt;lang&amp;gt; or Module:tr/db-&amp;lt;lang&amp;gt;/doc page&lt;br /&gt;
			-- * lua code: require(&amp;#039;Module:Tr/loaddata&amp;#039;).purge(&amp;lt;lang&amp;gt;)&lt;br /&gt;
			-- * template code: {{#invoke:tr|purge|lang=&amp;lt;lang&amp;gt;}}&lt;br /&gt;
			cache.set( &amp;#039;tr__database-&amp;#039;..lang, mw.text.jsonEncode(info))&lt;br /&gt;
			return info&lt;br /&gt;
		end&lt;br /&gt;
	end,&lt;br /&gt;
	&lt;br /&gt;
	purge = function(lang)&lt;br /&gt;
		cache.delete( &amp;#039;tr__database-&amp;#039;..lang)&lt;br /&gt;
	end&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>JamzOJamz</name></author>
	</entry>
</feed>