{"id":"pyseph/objectcache","name":"objectcache","scope":"pyseph","platform":"roblox","description":"A robust, blazing fast model and part cache for Roblox.","version":"1.4.6","latest":"1.4.6","versions":["1.1.0","1.1.1","1.2.0","1.3.0","1.4.0","1.4.1","1.4.3","1.4.4","1.4.5","1.4.6"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"e4c08894f98cbef4bed25aed1c6face1c734abfd2140cff37e3c8a02fd6b85a6","likes":0,"downloads":0,"install":"forest install pyseph/objectcache","url":"https://forest.dev/p/roblox/pyseph/objectcache","files":"https://api.forest.dev/ai/package/roblox/pyseph/objectcache/files","readme":"\r\n<h1 align=\"center\">\r\nObjectCache\r\n<div align=\"center\">A robust, blazing fast part cache for Roblox</div>\r\n\r\n## Introduction\r\nObjectCache is a modern implementation on handling thousands of active parts, while keeping performance high.\r\n\r\n## Why ObjectCache?\r\nThe source code is minimal and with no bloat, and with an important difference - it uses Roblox's `BulkMoveTo` API to achieve peak performance. Instead of manually setting the CFrame of each part one-by-one, all parts are batched together. And best of all, you don't need to worry about any of this! ObjectCache puts all returned objects into a queue to move them away, in the same frame as you call the method.\r\n\r\n# Supports models\r\nBy utilizing the engine's behavior, the ObjectCache supports using models directly -- and it remains as efficient as ever, much faster than calling `:PivotTo`! To use a model as the template, you just have to set a PrimaryPart, and weld all parts in the model to the PrimaryPart. ObjectCache will call `BulkMoveTo` on the PrimaryPart, which will automatically move all the other parts in the model with it, at much faster speeds than normal!\r\n\r\n## API\r\nThe API is dead simple - easy to learn, and eventually forget.\r\nObjectCache is fully typed, but an API reference is always handy to have:\r\n```luau\r\nObjectCacheConstructor.new(Template: BasePart, CacheSize: number?, CachesContainer: Folder?) -> ObjectCache\r\n\r\nObjectCache:GetPart(PartCFrame: CFrame?): BasePart\r\n\r\nObjectCache:ReturnPart(Part: BasePart)\r\n\r\nObjectCache:Destroy()\r\n```\r\nYou may have noticed that `ObjectCache:GetPart` lets you provide an optional target CFrame. This argument lets you squeeze out the maximum performance out of the module! Since `:GetPart(TargetCFrame)` and `:ReturnPart(Object)` both use queued `workspace:BulkMoveTo` calls, it can actually be more performant to call these two methods every frame.\r\nThe following video calls :GetPart and :ReturnPart every frame, yet runs smooth as butter:\r\n\r\n*The place file used in the above video* (*can be found here*)[]\r\n\r\n# Installation\r\n\r\nSimply grab the file from Roblox marketplace: https://create.roblox.com/store/asset/18819618773/ObjectCache\r\n","readmeTruncated":false}