PathOfBuildingCommunity / PathOfBuildingCommunity/PathOfBuilding
Convert GlobalCache to its own class
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 5.4k
- Forks
- 2.4k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 26
Description
In general, Common.lua should be for functions that can be used on any table or number or other type. Many of these functions there are very specific to the GlobalCache. A few options I'd rather see
- Make the functions more generic (e.g. for
mergeDBhere, have it bemergeTablesand call it twice for conditions and multipliers) - Move the functions to a separate file specifically for managing the GlobalCache (might be worth turning GlobalCache into a proper OO class potentially)
- Some of the functions are only used in one place. It might be better off having those functions in the file that uses them either as a local function or a function defined in that file instead of polluting the global namespace
Originally posted by @Wires77 in https://github.com/PathOfBuildingCommunity/PathOfBuilding/pull/2294#discussion_r602679854
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by auditing the GlobalCache-specific functions in Common.lua and tracing their call sites. Compare the three proposed directions—generic helpers, a dedicated GlobalCache file or class, and localizing single-use functions—before choosing a design. Done means the responsibilities are separated without changing existing behavior, but this issue does not define a specific acceptance test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100