Ask To Apps
  • Home
  • WordPress
  • Elasticsearch
  • PHP
  • Linux
  • Website Peformance

Tag : cache

Redis cache and its some important commands

September 5, 2015 Article

Redis is in-memory data structure store, used as database, cache replica cartier love bracelets and message broker. It stores data on disk and also hermes replica jewelry in memory. We can call it as permanent + memory storage. It supports data types like regular databases …

  • string
  • hash
  • list
  • set
  • sorted sets

It supports various queries and provides high availability via Redis Sentineland automatic partitioning with Redis Cluster. More ref can be found here – http://redis.io/

Installations

Download redis from redis.io or if you want old versions you can find it on google code – https://code.google.com/p/redis/downloads/list

$ wget http://download.redis.io/releases/redis-3.0.3.tar.gz
$ tar xzf redis-3.0.3.tar.gz
$ cd redis-3.0.3
$ make
$ sudo make install

# Start Redis
$ redis-server 

# Verify Redis server
$ redis-cli info

Commands for Get and Set

# String
$ redis-cli get keyname
$ redis-cli set keyname value

# All items from the List
$ redis-cli LRANGE keyname 0 -1
$ redis-cli RPUSH keyname value

# All items from the Set
$ redis-cli SMEMBERS 
$ redis-cli SADD keyname value  

# All items from the zset
$ redis-cli ZRANGE keyname 0 -1
$ redis-cli ZADD keyname fieldname value   

# All items from the Hash
$ redis-cli hgetAll keyname
$ redis-cli HSET keyname filed <a href="http://www.moggerhangerpark.com/ipg/cartier-love-bracelets-replica,83790225">cartier bracelets</a> value

# Get all the keys
$ redis-cli keys *

# Get type of a key
$ redis-cli type key

Categories: Linux, Other

Tags: cache, redis

About Author:

Appa

Cache PHP response in static file only in 10 line of code

October 13, 2013 Article

There are lot of techniques where you can optimize your php script. Here is simple and very easy example to get faster php response using file based cache in 10 line of code.Watch Full Movie Online Streaming Online and Downloadmovie War for the Planet of the Apes

You can use it mainly for ajax calls.

//Cache TTL(When to purge static file) in minutes
$ttl=10;

//Unique Cache Key
$key = &amp;quot;cache/&amp;quot;.md5($_SERVER['REQUEST_URI']);

//Purge Old Cache
if(@file_exists($key)){
$minutesBefore = (time()-@fileatime($key))/60;
if($minutesBefore&amp;amp;gt;$ttl){
@unlink($key);
}
}

//Get Cached Content
if(@file_exists($key)){
echo @file_get_contents($key);
exit;
}
//Write Into Buffer
ob_start();
//Your code

//.....
$content = ob_get_contents();
ob_clean();
//Create new cache i

@file_put_contents($key,$content);

//Print response content;
echo $content;

Categories: Linux, PHP, Website Peformance

Tags: cache, optimization, performance, php performance, static cache

About Author:

Recent Posts

  • Redis cache and its some important commands
  • Install and configure logstash-forwarder
  • Redirect request on php script through squid proxy
  • Alerting for Elasticsearch : Log watcher in elasticsearch using ES Watcher
  • Detect face from image using python script with OpenCV
  • Change mysql root password on centos
  • Search part of word in elasticsearch using nGram – auto-complete search
  • Connect VPN on centos linux using command line
  • Custom river plugin in elasticsearch
  • Backup elasticsearch with snapshot and restore api

Tags

apache Apache Lucene cache Distributed Elastic Index Elasticsearch elasticsearch performance Git Clone Git Hub Git Hub Configuration Git Hub Installation grep Import Install MySQL JSON over HTTP Linux Linux Command Linux Commands Linux search local file lsyncd md5sum Multile Domain Multisite MySQL Open Source optimization performance php performance real time search remote file Remote Git Hub remote sync RESTful Scale Schema Free Search Engine Search Index Search keyword static cache Sub Domain sync Very fast Wordpress Wordpress multisite

Copyright Ask To Apps 2017 | Proudly powered by WordPress

facebook twitter google linkedin Email Rss