php-Zend_Cache-Data must be a string or set to automatic_serialization=true
I'm trying to cache an array using Zend_Cache like this:
$cache = Zend_Registry::get('cache');// $data is an array$cache->save($data, 'externalData');
I get this error:
Message: Datas must be string or set automatic_serialization = true
Even with auto_serialization set to true when initializing Zend_Cache in the bootstrap file:
protected function _initCache(){ $frontend= array('lifetime' => 7200, 'automatic_seralization' => true); $backend= array('cache_dir' => 'cache'); $this->cache = Zend_Cache:: factory('core', 'File', $frontend, $backend);}
What is causing this error message?
Solution:
Maybe you just made a copy-paste error or a typo, but in the code you posted, you have:
$frontend= array('lifetime' => 7200, 'automatic_seralization' => true);
i.e. you set auto_seralization to true, not auto_serialization: note the i in serialization.
php-Zend_Cache-Data must be a string or set to automatic_serialization=true Related posts
- Implementing Async And Await With Generators
Nowadays we can write our asynchronous code in a synchronous way thanks to the asyncandawait keywords. This makes it easier to read and understand. Recently I wondered, however, how the same effect could be achieved without using these keywords.It turns out to be quite simple, since the behavior of ...
- How I used a simple Google query to mine passwords from dozens of public Trello boards
by Kushagra PathakHow I used a simple Google query to mine passwords from dozens of public Trello boardsA few days ago on 25th April, while researching, I found that a lotof individuals and companies are putting their sensitive information on their public Trello boards. Information like unfixed bugs ...
- Learn ES6+ in this free and interactive 23-part course
Click here to get to the course.JavaScript is undoubtedly one of the most popular programming languages in the world. It’s used almost everywhere: from large-scale web applications to complex servers to mobile and IoT devices.So we’ve partnered with Dylan C. Israel — a programming YouTuber and freeC ...
- How to scale Microservices with Message Queues, Spring Boot, and Kubernetes
by Daniele PolencicHow to scale Microservices with Message Queues, Spring Boot, and KubernetesWhen you design and build applications at scale, you deal with two significant challenges: scalability and robustness.You should design your service so that even if it is subject to intermittent heavy loads ...
- c#-How to call the OData function/operation generated by the OData client generator?
If I have an OData function with the following definition, link to my other questionbuilder.EntitySet("Ent");var companyActionConfig = builder.EntityType().Action("MethodX");entActionConfig.Parameter("SomeParam1");entActionConfig.Parameter("SomeParam2");entActionConfig.Returns();This leads to the fo ...
- How to go from Callbacks to Async Await in Node
by Nitish PhanseHow to go from Callbacks to Async Await in NodeI recently got a chance to work with Node again. Being a huge fan of promises, I never tried async await. Why? Because promises worked fine for me, that’s why.Sure thing promises work fine for simple controllers. Couple database querying ...
- A streaming library with a superpower: FS2 and functional programming
Scala has a very special streaming library called FS2 (Functional Streams for Scala). This library embodies all the advantages of functional programming (FP). By understanding its design goals you will get exposure to the core ideas that make FP so appealing.FS2 has one central type: Stream[Effect,O ...
- The best way to architect your Redux app
This article is about how to think in Redux. We’ll try to understand how we can utilise this wonderful library to make our application more stable, robust, and maintainable. It is language agnostic, however we will keep our scope to Redux with React.For those who haven’t used Redux before, I will qu ...
- A personal journey through the languages of data science
by Elena NisiotiA personal journey through the languages of data scienceOriginal image credit: OffensiveArtist [CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0)], from Wikimedia Commons, labeled for reuse with modificationOne does not simply walk into TensorFlow.A PhD is a good opportun ...
- How to implement map, filter, and reduce with recursion
Array.mapWe all probably know Array.map. It transforms an array of elements according to a given function.double = (x) => x * 2;map(double, [1, 2, 3]);// [2, 4, 6]I’ve always seen it implemented along these lines:map = (fn, arr) => { const mappedArr = []; for (let i = 0; i < arr.length; i++ ...
Recent Posts
- python - compare numpy structured arrays
quick questionI want to be able to compare specific dtype fields in two numpy structured arrays that are guaranteed to have the same dtype. I want to do this in a way that allows us to compare the fields each time a function is called on a given input (i.e. I can't easily do this for each field comp...
- php - avoid duplication of code in Laravel controller
In every controller of my Laravel app, I use all of this namespace:use App\User;use App\Http\Controllers\Controller;use Google\Auth\OAuth2;use Illuminate\Support\Facades\Input;use Illuminate\Support\Facades;use Illuminate\Support\Facades\Log;use Illuminate\Support \Facades\View;use Illuminate\Suppor...
- javascript - how to start a script in HTML without tags?
I'm currently using a low-code development platform called WaveMaker, which gives you custom page"markup"(HTML, but you can't really edit the <head> option; nice pages throughout), especially pages like Events like onpageload, the page's styles (CSS) and the page's variables (JSON). I'm trying...
- use python django to unzip/unzip files
I'm trying to write a distributable web application that allows users to upload a compressed archive (rar or zip), extract it on the server side, and then do other things with the file. Is there a default library I can hook into to do this? Or is there a way to package an external library with a web...
- python - how to allow only admin to execute commands
I am writing the following [email protected](pass_context=True)async def admins_only_command(ctx, *, args): '''do stuffHow can I restrict this command to admin only? I tried looking at ctx.author.roles.role and it says @everyone. How can I check if a given user is an admin?Solution:There are two w...
- javascript – Android browser touch event location
On Safari, you can get where the user touches the screen from event.pageX and event.pageY. However, on my Android browser, event.pageX and event.pageY are always 0. Is there a way to browse on Android where to get the touch event in the browser?Solution:It's memory, since I don't own an Android devi...
- where did you get the inode function?
I have some Linux drivers that I'm trying to port from Linux 2.4 to 3.0. During this long time, the parameter list for ioctl (now unlocked_ioctl ) changed a bit:-static int can_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)+static long can_ioctl(struct file *file,...
- javascript - what is the purpose of the useCapture parameter of object.addEventListener?
See English answer > Unable to understand useCapture parameter in addEventListener 9 I'm trying to understand true or false when adding addEventListener in Internet Explorer. According to Microsoft, it's useCapture. If I add an event like:element.addEventListener('click', function_name, true);It ...
- [Architect Skills Sharing] Programmer Interview Meituan: The interviewer suddenly asked Java "lock" how should you answer?
[Architect Skills Sharing] Programmer Interview Meituan: What should you answer when the interviewer suddenly asks Java"lock"?Java provides a variety of locks, each of which can show very high efficiency in appropriate scenarios due to its different characteristics. This article aims to give example...
- python – Django download file
I'm new to using Django and I'm trying to develop a website where users can upload a lot of excel files, which are then stored in the media folder Webproject/project/media.def upload(request): if request.POST: form = FileForm(request.POST, request.FILES) if form.is_valid(): form.save() return render...