-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG] Model MetaData reset method has little impact #1934
Comments
Fix submitted (#1952) |
Could you please check and close this bug if everything works for you? |
I have downloaded and compiled the latest version of 1.3.0 and can see code in apc.c and files.c suggesting something different should happen but nothing different does happen. If I use reset() whilst using Phalcon\Mvc\Model\MetaData\Files(), for example, the files are not removed from the file system. Neither apc.c or files.c seem to clear anything out and then return the same structure. Have I downloaded the incorrect version? phpversion('phalcon') returns 1.3.0 after compiling. The php notice warning also still exists for #1952 still. |
php build/gen-build.php then rebuild Phalcon. |
The php notice warning #1952 is fixed. Phalcon\Mvc\Model\MetaData\Files::reset() now works well. Phalcon\Mvc\Model\MetaData\Apc::reset() still has an issue in that Metadata stored within Apc does not get reset unless there is some metadata already loaded into local memory. So if I try to reset Apc at the start of a script to clear out stale/incorrect metadata left over at the end of a previous iteration nothing gets cleared causing an error if the table structures are different.
I would also argue that all metadata cache methods need to support the 'prefix' option to allow for multi-user multi-server environments where a developer may want to cache the structure of tables on localhost but also cache the structures on remotehost at the same time but flick between the two depending on which user or host is in use. I see at least one other framework makes use of the connection dsn + username to create keys for the storage of such data to deal with this situation. Just a suggestion. |
None of the following model metadata cache options do anything other than remove the cached data from memory when the reset() method is called. So when the meta data is reloaded it is obtained from the cache again as it was before reset() was called rather than recalculated from the db which is what I would expect to happen after calling reset().
Phalcon\Mvc\Model\MetaData\Apc
Phalcon\Mvc\Model\MetaData\Files
Phalcon\Mvc\Model\MetaData\Xcache
I am using reset() when switching between different databases when using the same model i.e. Robots on localhost and Robots on remoteHost which may have slightly different table structures.
The text was updated successfully, but these errors were encountered: