I encountered a problem with routes cache of Luracast restler. For instance, i have 2 urls:
/api/service/resale/getmapinfo
/api/service/precon/getmapinfo
They work with 2 classes correspondingly:
When I reach the first url, then in the cache appears info of methods for the first class.
Then I try to reach the second url, and then restler reads the cache and finds there only the routes for the first class so i receive a 404 error (because there is no info about the second class).
Moreover, when i first go to incorrect url (in purpose) the routes.php
cache is saved with an empty array. Then I get 404 on all the urls that i try to reach.
Basically what i see in the code is that the cache system is not based on class, but have one common cache that is written only once, first time when you reach a url. Please advice, is it something that i'm doing wrong or this is an incorrect behavior of restler?
Looks like you need to regenerate the routes.php
as you have added new classes and or modified api methods, you can simply delete the routes.php
to create new one based on the latest setup
Ideally when you are in the process of developing the api don't turn on the production_mode
so instead of
$r = new Restler(true); //in production mode
do
$r = new Restler(); //in debug mode, will generate routes every time
or if you want to see the generated routes, but keep overwriting the routes.php
every time
$r = new Restler(true,true);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.