Skip to content
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

Aerospike Cache prepare content part missing #739

Open
dercoder opened this issue Feb 28, 2017 · 5 comments
Open

Aerospike Cache prepare content part missing #739

dercoder opened this issue Feb 28, 2017 · 5 comments

Comments

@dercoder
Copy link

The content will not be prepared like here:
https://github.com/phalcon/cphalcon/blob/master/phalcon/cache/backend/redis.zep#L226
https://github.com/phalcon/cphalcon/blob/master/phalcon/cache/backend/redis.zep#L173

@sergeyklay
Copy link
Member

The Aerospike client (C-extension) able to do it myself. Or I did not understand you. Could you please elaborate on that?

@dercoder
Copy link
Author

For example i want to use Igbinary or Base64 frontend to save this data in this format to Aerospike server.
Here
https://github.com/phalcon/incubator/blob/master/Library/Phalcon/Cache/Backend/Aerospike.php
the frontend cache convertation will be ignored.
$frontend->beforeStore(); and $frontend->afterRetrieve(); is missing in this code

@sergeyklay
Copy link
Member

Yes, I understand you. But what problems it causes?

@dercoder
Copy link
Author

Next example:

<?php 
$frontendCache = new Base64([
    'lifetime' => 1800
]);

$backendCache = new Aerospike($frontendCache, [
    'hosts'      => [
        ['addr' => '127.0.0.1', 'port' => 3000]
    ],
    'persistent' => true,
    'namespace'  => 'test',
    'prefix'     => 'cache_',
    'options'    => [
        \Aerospike::OPT_CONNECT_TIMEOUT => 1250,
        \Aerospike::OPT_WRITE_TIMEOUT   => 1500
    ]
]);

Data will be saved at Aerospike server as array and not as base64 string.
Other backend cache will convert it correct like Redis, Memcache, ...
So the Aerospike backend cache is not really compatible.

The reason why i convert the data is that Aerospike can not handle big arrays.
So i want to convert them to strings.

PHP Fatal error:  Uncaught exception 'Phalcon\Cache\Exception' with message 'Failed storing data in Aerospike: Cannot allocate as_string' 

@dercoder
Copy link
Author

Some more informations:
https://github.com/aerospike/aerospike-client-php/blob/master/doc/README.md#handling-unsupported-types

This is also very important to save data as bytes and not as strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants