-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Caching feature (or documentation) #13
Comments
This package saves the data in disk so that by itself is kind of cache, since it only has to find it in a file rather then do a database query. One way i see of cacheing the results giving by this package is to edit it a little bit. Then all you need to do to get the attributes from the specific site is to: Then you can do this in your routes file (web.php)
This is a shit mix kind of, dont use this in production There is a better way of doing this and that would be to initialize the Manager with the variables you stored in cache. Since when you do $page->load('home') you really dont need to pass anything into the view, you can just access it with {{ Page::get('key') }} If you want help to figure this out, let me know. this is just knowledge i gathered from using this package, i didnt make it 👍 |
@jake-harris caching the view output is a bad idea. Caching your database results is way more easier in your controller. $users = cache()->remember('users', 120, function(){
return User::all();
});
return view()->with(compact('users')); |
@wimurk I'm sorry if I'm dense, but I don't see how that's relevant in the scope of this discussion. There's nothing to cache from the database because it's not pulling it from the database, rather it's accessing the contents of a file. Ideally I'd like to cache the contents of that file, so it's not a disk IO every request on high-volume pages, e.g. the Home page. |
And to clarify, I'm not asking about how to cache, rather, I don't see a way to "grab" the values with the API of |
Hi there, Caching would indeed be useful when the cache driver is set to anything else than I see two options:
I would be glad to discuss this further before accepting PRs or implementing it myself. Cheers! |
This might be more relevant with the database source now |
Hi there!
This package looks terrific -- kudos for putting it out.
Have you thought about supporting caching? Something where we could set a default TTL in a config would be fantastic. On the Nova end it would have to bust that cache up update as well.
If it's possible to implement this manually, e.g. at the controller level, could you please let me know how? I planned to cook it up myself and submit a PR with documentation, but at first glance through the source and documentation, I couldn't come up with a way to do it.
The text was updated successfully, but these errors were encountered: