Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add files

  • Loading branch information...
commit ce3709fadac0d1c96631e33c17a9976b9276871b 0 parents
@jsimone jsimone authored
4 .gitignore
@@ -0,0 +1,4 @@
+.classpath
+.settings/
+target
+.project
1  Procfile
@@ -0,0 +1 @@
+worker: sh target/bin/memcache
57 pom.xml
@@ -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>
33 src/main/java/com/heroku/devcenter/Main.java
@@ -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"));
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.