. Watermark (Image watermark, text watermark)18. Generate or parse two-dimensional code19.HTML5 + Java EE WebSocket Communication technology20. Batch asynchronous upload pictures, can preview, there is a progress bar, support drag-and-drop upload (Baidu Webuploader). List dynamic slide zoom display.21.ehcache Custom Level Two cache, choose cache to store director
1: InstallationInstallation can be divided into single-version Redis and cluster version of Redis installation is relatively simple, self-Baidu can2: IntegrationPom file with Jedis dependencies, Spring creates Redis's application-resid configuration, which configures Redis's standalone and cluster configurations separately, noting the need for connection pooling3: Writing the DAO layerBecause of the need to be compatible with the standalone and cluster version, write the interface, respectively,
JCS is an implementation of cache in Java. It supports caching data to the memory or hard disk and setting the effective duration of the cache object. The following JAR packages are required for use:
Commons-collections-2.1.1.jar
Commons-lang.2.3.jar
Commons-logging-1.0.4.jar
Concurrent-1.3.2.jar
Jcs-1.3.jar
Slf4j-api.jar
Define the storage object c
Maven Introduction1 Dependency>2 groupId>Javax.cachegroupId>3 Artifactid>Cache-apiArtifactid>4 version>1.1.0version>5 Dependency>Concept
Cachingprovider: Defines the creation, configuration, acquisition, management, and control of multiple CacheManager. An app can access multiple CacheManager at run time.
CacheManager: Defines the creation, configuration, acquisition, management, and control of multiple uniquely named caches t
("192.168.248.129", 6379); int balance = 1000;//Available Balance int debt;//amount owed int amttosubtract = amount;//actual brush limit jedis.set ("balance" , string.valueof (balance)); Jedis.watch ("balance"); Jedis.set ("Balance", "1100");//This sentence should not appear, in order to simulate other programs have modified the entry balance = Integer.parseint (Jedis.get ("balance")); if (Balance Run it again and look at the effect:This means that if the data ha
After downloading the source code of Oscache, you need to add some functions. Compile the code after importing eclipse. The cache. Java file reports the following error:
Description resource path location typeThe Method Add (class
Description resource path location typeThe method remove (class
I checked the document on Oscache and found no problem.The JDK version is suspected to be a problem. The machi
writing)read/write lock - Simulation Cache system implementation:public class Cachedemo {private mapSummarize:the function of read and write locks is that when we add a write lock, other threads are blocked, only one write operation is executed, and when we add a read lock, it is not restricted to multiple read threads to access. that is, the get and put are mutually exclusive,and theput is mutually exclusive to any thread, but get and Get threads
On the Code packagecom.lemon.demo.test;importjava.util.arraylist;import org.apache.commons.collections.mapiterator;importorg.apache.commons.collections.map.lrumap;/** * @author bjs*/publicclassCrunchifyInMemoryCache Test class Why do this thing, I have a big rub, because recently made a mobile phone client service interface, to save a last login time, the database has only one field lastlogintime, then, in order to minimize the database pollution, so I realized a
When drawing images in Java, you need to cache images for speed. Write a sample code for your reference.
Import Java.awt.Color;Import Java.awt.Container;Import Java.awt.Graphics;Import Java.awt.Graphics2D;Import Java.awt.Image;Import java.awt.Transparency;Import Java.awt.event.WindowAdapter;Import java.awt.event.WindowEvent;Import Java.awt.image.BufferedImage;
Import Javax.swing.JFrame;Import Javax.swing.
The code is as follows: while (True) { Map Logical thinking, the data exists in a linklist, if the save time is. Thread loop deletes the last element Removelast (), while adding element ADDFIRSR () to the head; In the same vein, it feels better to queue blackquere. Implementation of Java timed cache
Implement caching some data locally, avoid querying the database repeatedly, stress the database, the code is as follows:Package Threadlock;import Java.util.hashmap;import java.util.map;import Java.util.concurrent.locks.readwritelock;import Java.util.concurrent.locks.ReentrantReadWriteLock; Public classCathedemo {PrivatemapNewHashmap(); PrivateReadwritelock RWL =NewReentrantreadwritelock ();//defining read-write Locks PublicObject getData (String key) {Rwl.readlock ().Lock(); Object valu
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.