This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ce3709f
Showing
4 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.classpath | ||
.settings/ | ||
target | ||
.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
worker: sh target/bin/memcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.heroku.devcenter</groupId> | ||
<artifactId>memcacheSample</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<repositories> | ||
<repository> | ||
<id>spy</id> | ||
<name>Spy Repository</name> | ||
<layout>default</layout> | ||
<url>http://files.couchbase.com/maven2/</url> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>spy</groupId> | ||
<artifactId>spymemcached</artifactId> | ||
<version>2.7.3</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
|
||
<build> | ||
<plugins> | ||
<!-- The maven app assembler plugin will generate a script that sets up the classpath and runs your project --> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>appassembler-maven-plugin</artifactId> | ||
<version>1.1.1</version> | ||
<configuration> | ||
<assembleDirectory>target</assembleDirectory> | ||
<programs> | ||
<program> | ||
<mainClass>com.force.sample.Main</mainClass> | ||
<name>memcache</name> | ||
</program> | ||
</programs> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>assemble</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.heroku.devcenter; | ||
|
||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
import java.util.ArrayList; | ||
|
||
import net.spy.memcached.MemcachedClient; | ||
|
||
public class Main { | ||
|
||
/** | ||
* @param args | ||
* @throws IOException | ||
* @throws URISyntaxException | ||
*/ | ||
public static void main(String[] args) throws IOException, URISyntaxException { | ||
// AuthDescriptor ad = new AuthDescriptor(new String[]{"PLAIN"}, | ||
// new PlainCallbackHandler("app1805387@heroku.com", "k/aoMGr9EcKo4Sa6")); | ||
// ConnectionFactoryBuilder factoryBuilder = new ConnectionFactoryBuilder(); | ||
// ConnectionFactory cf = factoryBuilder.setProtocol(Protocol.BINARY).setAuthDescriptor(ad).build(); | ||
|
||
URI base = new URI("http://" + System.getenv("MEMCACHE_SERVERS") + ":11211"); | ||
ArrayList<URI> baseURIs = new ArrayList<URI>(); | ||
baseURIs.add(base); | ||
MemcachedClient memcachedClient = new MemcachedClient(baseURIs, "default", System.getenv("MEMCACHE_USERNAME"), System.getenv("MEMCACHE_PASSWORD")); | ||
|
||
// MemcachedClient memcachedClient = new MemcachedClient(AddrUtil.getAddresses("mc7.ec2.northscale.net:11211"), "app1805387@heroku.com", "k/aoMGr9EcKo4Sa6"); | ||
memcachedClient.add("test", 0, "testData"); | ||
System.out.println(memcachedClient.get("test")); | ||
} | ||
|
||
} |