Skip to main content

Posts

Showing posts from March, 2022

Memcache Basics

Key Features of Memcache. 1- It's open source. Memcache server is a big hash table it significantly reduces the database load it's perfect for a website which has High Database Load. its client-server application over TCP/UDP How to Install it on Linux, Sudo apt-get install Memcached Default Port is - 11211 To connect to the Memcache server you need to use the Telnet command on HOST & PORT cmd - $telnet HOST PORT For exp - $ telnet 127.0.0.1 11211 Memcache set command is used to set a new value to a new or existing key. Command:-  set kEY FLAGS EXPTIME BYTES (noreplay) Value - KEY - name of the key - FLAGS - Its 32-bit unassigned integer that the server stores with the data provided by the user, and returns along with the data during the fetch - EXPTIME - expiration time in seconds - BYTES - Length of data(in bytes) which need to store in Memcache - noreplay - this parameter informs not to send any replay  from the server during the set - VALUE - It is the data that we nee...

MongoDB Uses

  To use MongoDB with PHP, you need to use MongoDB PHP driver. Add  extension = php_mongo.dll in php.ini file $m = new MongoClient (); echo "Connection to database successfully" ; // select a database $db = $m -> mydb ; It will create the connection & also select the database. if Database is not available then it will create automatically. $collection = $db -> createCollection ( "mycol" ); It will create a new collection in the DB. $db = $m -> mydb ; echo "Database mydb selected" ; $collection = $db -> mycol ; echo "Collection selected succsessfully" ; $document = array ( "title" => "MongoDB" , "description" => "database" , "likes" => 100 , "url" => "http://www.tutorialspoint.com/mongodb/" , "by" => "tutorials point" ); $collectio...