-
Notifications
You must be signed in to change notification settings - Fork 42
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
feat: Add a Cache
API
#26
Conversation
Any thoughts on this @xtuc? |
Serializing the module to a string seems a bit inefficient to me, and I doubt someone would manipulate the string in PHP. However, manipulating an opaque pointer to the compiled module seems useful. A use-case that comes to my mind is the threading proposal, which requires to instantiate the same compiled Module multiple times. I'm really not aware of PHP extensions work, but is there a way to keep something in memory for multiple requests? Ideally to me, the opaque pointer would be managed by wasmer. |
a47195c
to
5bbc228
Compare
It is possible to get a persistent data in PHP yes. I don't know how, but I know it is :-). @nikic Do you think it's a good idea to get a persistent opaque pointer between PHP requests? If yes, any idea how to implement that? Thanks! |
@Hywan As long as you don't use the per-request allocator, keeping persistent data between request is (on a technical level) not a problem. You need to stick your opaque pointer into globals somewhere and have a mechanism on the PHP side for how it can be accessed again on the next request. (A common example for persistent data are persistent database resources -- but actually using resources is not necessary.) |
@nikic Do you know if an extension already does that? Or if Zend offers an API for that? I'm interested by the persistent resource, any documentation? Thanks! |
5bbc228
to
ab8d07f
Compare
I'll address the persistent modules or instances in another issue. |
Fix #18.
Blocked by #25 (this PR contains all its commits).This PR adds a
Wasm\Cache
API:The cache API is based on PSR-16.